
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
ixtlan-user-management
Advanced tools
the idea is to register the remote rest(ful) servers at one place and then just talk to a rest-manager to make a rest http request.
for example configure the 'users' server like this
rest = Ixtlan::Remote::Rest.new
rest.server( :users ) do |s|
s.url = 'http://example.com/rest'
s.add_model( Admin )
s.add_model( Account, "path/to/accounts" )
s.add_model( Locale )
end
now you can do something like this:
a = rest.create( Admin.new( :id => 1, :name => 'me and the corner' ) ) # #<Admin @id=1 @name="me and the corner">
rest.retrieve( Admin, 1 ) # #<Admin @id=1 @name="me and the corner">
a.name = 'me'
rest.update( a ) # #<Admin @id=1 @name="me">
rest.delete( a )
or the same with less magic
a = rest.create( :admins, { :id => 1, :name => 'me and the corner' } # #<Admin @id=1 @name="me and the corner">
rest.retrieve( :admins ) # [#<Admin @id=1 @name="me and the corner">]
rest.update( :admins, 1, { :id => 1, :name => 'me' } ) # #<Admin @id=1 @name="me">
rest.delete( :admins, 1 )
where the last argument is the payload and the first argument is the model (either Class, String or Symbol). the rest will be joined as "path" and appended to the baseurl of the model.
the instantiation of the model objects (Admin, Account, etc) works either with passng in the attributes into the constructor (Admin.new( attributes ), etc) or with DataMapper it will try to load the object first from the datastore and then updates its attributes (no save only update on local object).
possible setting: there are loosely coupled miniapps which share data between them but only one miniapp can modify that data. i.e. one app manages users/groups and their authentication, another app allows to translate the i18n of apps and manages the list of allowed locales, etc. so let's say there are user data (a subset of the users-app user) and locale data which are needed in an app then you can sync them lke this:
sync = Ixtlan::Remote::Sync.new( rest )
sync.register( Locale )
sync.do_it # i.e. "update Locale - total: 1 success: 1 failures: 0"
that sync.do_it can run in a cronjob and your data gets easily syncronized between miniapps. one could call it a master-slave setup for quasi static data. quasi static like users or locales or venue locations or list of countries etc. quasi static since you sync with a cronjob maybe running once a day or maybe each hour. for volatile data you better use the remote server directly, i.e. for authentication.
git checkout -b my-new-feature)git commit -am 'Added some feature')git push origin my-new-feature)enjoy :)
FAQs
Unknown package
We found that ixtlan-user-management demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.