Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
angular-reaccess
Advanced tools
AngularJS tools to customize users interfaces based on their rights on the REST API.
AngularJS tools to customize users interfaces based on their rights on the REST API.
See those slides to know more about the
reaccess
project principles.
Consider the following template:
<button
ng-show="'USER_ADD' | sfReaccess"
ng-click="addUser()">Add a user</button>
<div ng-repeat="user in users">
{{ user.name }}
<button
ng-show="'USER_EDIT' | sfReaccess:user"
ng-click="editUser(user)">Edit this user</button>
<button
ng-show="USER_DELETE' | sfReaccess:user"
ng-click="removeUser(user)">Delete this user</button>
</div>
It will display add/edit/delete buttons depending on the user rights comparing to the methods and pathes set for the given predefined rights.
Predefined rights are set in your application configuration like this:
angular.module('myApp')
.config(['sfReaccessServiceProvider', 'profileService', function(sfReaccessServiceProvider) {
// Setting templated rights
$sfReaccessServiceProvider.setPredefinedRights({
'USER_ADD': [{
path: '/users/:id',
methods: ['GET', 'POST']
}],
'USER_EDIT':[{
path: '/users/:id',
methods: ['PUT']
}],
'USER_DELETE': [{
path: '/users/:id',
methods: ['GET', 'DELETE']
}]
});
}]);
User rights are set by using the sfReaccessService.setRights()
method,
they look like this:
sfReaccessService.setRights([{
path: "/users/:_id/?.*",
methods: [
"OPTIONS",
"HEAD",
"GET",
"POST",
"PUT",
"PATCH",
"DELETE"
]
},{
path: "/organisations/:organisation_id/?.*",
methods: [
"OPTIONS",
"HEAD",
"GET",
"POST",
"PUT",
"PATCH",
"DELETE"
]
}]);
Path values are templated regular expressions. To set objects where to search
for template expressions values, use sfReaccessService.setValues()
:
sfReaccessService.setValues([{
_id: 1,
organisation_id: 1
}]);
You can enable sfReaccess debug mode globally:
angular.module('myApp')
.config(['sfReaccessServiceProvider', function(sfReaccessServiceProvider) {
// Set debug mode
$sfReaccessServiceProvider.debug(true);
}]);
Or locally as an argument to the angular filter:
<button
ng-show="'USER_ADD' | sfReaccess: undefined : true"
ng-click="addUser()">Add a user</button>
To contribute to this project, first run the following to setup the development environment:
npm install
bower install
Then, run the tests and debug with Karma:
npm run dev
If you use Express for your backend, you may be interested by the
express-reaccess
middleware.
FAQs
AngularJS tools to customize users interfaces based on their rights on the REST API.
The npm package angular-reaccess receives a total of 1 weekly downloads. As such, angular-reaccess popularity was classified as not popular.
We found that angular-reaccess demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.