Class SecurityManager
A class which provides a security manager functionality. It can be
used for managing users, groups and organizations information. Use
HTTPFabricConnection#getSecurityManager method to get the
security manager for the fabric connection.
Defined in: <D:\Programs\Neeve\Projects\NeeveBuild16\stjsapi/src/main/webapp/js\SecurityManager.js>.
Constructor Attributes | Constructor Name and Description |
---|---|
SecurityManager(fabricConnection)
Creates a security manager for a fabric connection
|
Method Attributes | Method Name and Description |
---|---|
void |
addUserToGroup(userName, groupName, callback)
Asynchronously adds the specified user to the specified group in Fabric.
|
void |
createGroup(name, description, callback)
Asynchronously creates a new users group in Fabric with the specified
name and description.
|
void |
createOrganization(name, description, callback)
Asynchronously creates a new organization in Fabric with the specified
name and description.
|
void |
createUser(name, password, description, vcard, callback)
Asynchronously creates a new user in Fabric with the specified login name,
password and description.
|
void |
disableUser(name)
Disables the specified user
|
void |
dropGroup(name, callback)
Asynchronously drops the specified users group from Fabric.
|
void |
dropOrganization(name, callback)
Asynchronously drops the specified organization from Fabric.
|
void |
dropUser(name, callback)
Asynchronously drops the specified user from Fabric.
|
void |
enableUser(name)
Enables the specified user
|
void |
existsGroup(name, callback)
Asynchronously checks the specified users group in Fabric.
|
void |
existsOrganization(name, callback)
Asynchronously checks the specified organization in Fabric.
|
void |
existsUser(name, callback)
Asynchronously checks the specified user in Fabric.
|
String |
Returns the name of the user for the current connection to Fabric
|
void |
getGroups(callback)
Asynchronously gets all the user groups registered in Fabric.
|
void |
getOrganizations(callback)
Asynchronously gets all the organizations registered in Fabric.
|
void |
getUsers(callback)
Asynchronously gets all the users registered in Fabric.
|
void |
getVCard(name, callback)
Asynchronously gets vcard for the specified user.
|
void |
listGroups(callback)
Asynchronously lists all the user groups registered in Fabric.
|
void |
listOrganizations(callback)
Asynchronously lists all the organizations registered in Fabric.
|
void |
listUsers(callback)
Asynchronously lists all the users registered in Fabric.
|
void |
lookupGroup(name, callback)
Asynchronously looks up the specified users group in Fabric.
|
void |
lookupOrganization(name, callback)
Asynchronously looks up the specified organization in Fabric.
|
void |
lookupUser(name, callback)
Asynchronously looks up the specified user in Fabric.
|
void |
removeUserFromGroup(userName, groupName, callback)
Asynchronously removes the specified user from the specified group in
Fabric.
|
void |
setGroupOrganization(groupName, organizationName, callback)
Asynchronously sets the specified organization for the specified group in
Fabric.
|
void |
setOrganizationDomain(organizationName, domain, callback)
Asynchronously sets the specified domain for the specified organization in
Fabric.
|
void |
setUserOrganization(userName, organizationName, callback)
Asynchronously sets the specified organization for the specified user in
Fabric.
|
void |
setVCard(name, vcard, callback)
Asynchronously sets the specified user vcard.
|
void |
updateGroup(group, callback)
Asynchronously updates the specified userd group in Fabric.
|
void |
updateOrganization(organization, callback)
Asynchronously updates the specified organization in Fabric.
|
void |
updateUser(user, callback)
Asynchronously updates the specified user in Fabric.
|
Class Detail
SecurityManager(fabricConnection)
Creates a security manager for a fabric connection
- Parameters:
- {HTTPFabricConnection} fabricConnection
- The fabric connection for which the security manager is returned
Method Detail
addUserToGroup(userName, groupName, callback)
Asynchronously adds the specified user to the specified group in Fabric.
If the current user of this fabric connection doesn't have rights for it
or if the specified user or the group doesn't exist in Fabric, then an
exception is returned by the server. If this operation succeeds then the
specified
callback(response, sequenceId, success)
function is
called with 'success' equal to 'true':
callback(null, sequenceId, true)
.
- Parameters:
- {String} userName
- The login name of the user to be added to the specified group
- {String} groupName
- The name of the group to which the user should be added
- {Function} callback
- The callback function called with 'null' response or an exception. (See HTTPFabricConnection for a callback description). Callback object type: {null}.
createGroup(name, description, callback)
Asynchronously creates a new users group in Fabric with the specified
name and description. If the current user of this fabric connection
doesn't have rights to create a new group or if a group with the specified
name already exists in Fabric, then an exception is returned by the
server. If a new group is created then the corresponding
Group
object is passed to the specified callback
function when it is returned from server side. See Security.Group
class for its methods description. The example of a Group
is
shown below:
var group = { '@type' : 'com.streamscape.sef.security.Group', name : { str : 'guests' }, description : 'Fabric guest users', organization : { str : 'StreamScape Technologies' }, members : [ { str : 'streamscape' }, { str : 'streamscape2' } ], accessControlList : { '@type' : 'AccessControlList', operations : [ { '@type' : 'AccessControlOperation', value : 'CLIENT_RAISE_EVENT' }, { '@type' : 'AccessControlOperation', value : 'CLIENT_RAISE_EXCEPTION' } ] } }
- Parameters:
- {String} name
- The name of the users group to be created
- {String} description
- The description of the users group to be created
- {Function} callback
- The callback function called with the created group object. (See HTTPFabricConnection for a callback description). Callback object type: Security.Group.
createOrganization(name, description, callback)
Asynchronously creates a new organization in Fabric with the specified
name and description. If the current user of this fabric connection
doesn't have rights to create a new organization or if an organization
with the specified name already exists in Fabric, then an exception is
returned by the server. If a new organization is created then the
corresponding
Organization
object is passed to the specified
callback
function when it is returned from server side. See
Security.Organization for its methods description.
The example of a Organization
is shown below:
var organization = { '@type' : 'com.streamscape.sef.security.Organization', name : 'StreamScape Technologies', description : 'R&D Company', members : [ { str : 'streamscape' }, { str : 'streamscape2' } ] }
- Parameters:
- {String} name
- The name of the organization to be created
- {String} description
- The description of the organization to be created
- {Function} callback
- The callback function called with the created organization object. (See HTTPFabricConnection for a callback description). Callback object type: Security.Organization.
createUser(name, password, description, vcard, callback)
Asynchronously creates a new user in Fabric with the specified login name,
password and description. If the current user of this fabric connection
doesn't have rights to create a new user or if a user with the specified
name already exists in Fabric, then an exception is returned by the
server. If a new user is created then the corresponding
User
object is passed to the specified callback
function when it
is returned from server side. (See SecurityManager#updateUser for
'Security.User' class description).
- Parameters:
- {String} name
- The name of the user to be created
- {String} password
- The password of the user to be created
- {String} description
- The description of the user to be created
- {Object} vcard
- The profile (vCard) of the user to be created
- {Function} callback
- The callback function called with the created user object. (See HTTPFabricConnection for a callback description). Callback object type: Security.User.
disableUser(name)
Disables the specified user
- Parameters:
- {String} name
- The name of the user to be disabled
dropGroup(name, callback)
Asynchronously drops the specified users group from Fabric. If the current
user of this fabric connection doesn't have rights to drop a group or if
the group with the specified name doesn't exist in Fabric, then an
exception is returned by the server. If the group is dropped then the
specified
callback(response, sequenceId, success)
function is
called with 'success' equal to 'true':
callback(null, sequenceId, true)
.
- Parameters:
- {String} name
- The name of the group to be dropped
- {Function} callback
- The callback function called with 'null' response or an exception. (See HTTPFabricConnection for a callback description). Callback object type: {null}.
dropOrganization(name, callback)
Asynchronously drops the specified organization from Fabric. If the
current user of this fabric connection doesn't have rights to drop an
organization or if the organization with the specified name doesn't exist
in Fabric, then an exception is returned by the server. If the
organization is dropped then the specified
callback(response, sequenceId, success)
function is called
with 'success' equal to 'true':
callback(null, sequenceId, true)
.
- Parameters:
- {String} name
- The name of the organization to be dropped
- {Function} callback
- The callback function called with 'null' response or an exception. (See HTTPFabricConnection for a callback description). Callback object type: {null}.
dropUser(name, callback)
Asynchronously drops the specified user from Fabric. If the current user
of this fabric connection doesn't have rights to drop a user or if the user
with the specified name doesn't exist in Fabric, then an exception is
returned by the server. If the user is dropped then the specified
callback(response, sequenceId, success)
function is called
with 'success' equal to 'true':
callback(null, sequenceId, true)
.
- Parameters:
- {String} name
- The login name of the user to be dropped
- {Function} callback
- The callback function called with 'null' response or an exception. (See HTTPFabricConnection for a callback description). Callback object type: {null}.
enableUser(name)
Enables the specified user
- Parameters:
- {String} name
- The name of the user to be enabled
existsGroup(name, callback)
Asynchronously checks the specified users group in Fabric. If the current
user of this fabric connection doesn't have rights to check a group, then
an exception is returned by the server. Else the specified
callback(response, sequenceId, success)
function is called
with 'response' equal to 'true' if the specified group exists in Fabric or
'false' otherwise: callback(doesGroupExist, sequenceId, true)
- Parameters:
- {String} name
- The name of the group to be found
- {Function} callback
- The callback function called with 'true' or 'false' response or an exception. (See HTTPFabricConnection for a callback description). Callback object type: {boolean}.
existsOrganization(name, callback)
Asynchronously checks the specified organization in Fabric. If the current
user of this fabric connection doesn't have rights to check an
organization, then an exception is returned by the server. Else the
specified
callback(response, sequenceId, success)
function is
called with 'response' equal to 'true' if the specified group exists in
Fabric or 'false' otherwise:
callback(doesOrganizationExist, sequenceId, true)
- Parameters:
- {String} name
- The name of the organization to be found
- {Function} callback
- The callback function called with 'true' or 'false' response. (See HTTPFabricConnection for a callback description). Callback object type: {boolean}.
existsUser(name, callback)
Asynchronously checks the specified user in Fabric. If the current user
of this fabric connection doesn't have rights to check a user, then an
exception is returned by the server. Else the specified
callback(response, sequenceId, success)
function is called
with 'response' equal to 'true' if the specified user exists in Fabric or
'false' otherwise: callback(doesUserExist, sequenceId, true)
.
- Parameters:
- {String} name
- The login name of the user to be found
- {Function} callback
- The callback function called with 'true' or 'false' response. (See HTTPFabricConnection for a callback description). Callback object type: {boolean}.
{String}
getCurrentUserName()
Returns the name of the user for the current connection to Fabric
- Returns:
- The current user name
getGroups(callback)
Asynchronously gets all the user groups registered in Fabric. If the
current user of this fabric connection doesn't have rights for it then an
exception is returned by the server. Otherwise the specified
callback(response, sequenceId, success)
function is called with 'success' equal to 'true' and 'response' equal to
the list of 'Group' records returned by the server (see
SecurityManager#createGroup method for 'Group' definition):
callback(groupsList, sequenceId, true)
.
- Parameters:
- {Function} callback
- The callback function called with the returned group records list. (See HTTPFabricConnection for a callback description). Callback object type: Security.Group[].
getOrganizations(callback)
Asynchronously gets all the organizations registered in Fabric. If the
current user of this fabric connection doesn't have rights for it then an
exception is returned by the server. Otherwise the specified
callback(response, sequenceId, success)
function is called with 'success' equal to 'true' and 'response' equal to
the list of 'Organization' records returned by the server (see
SecurityManager#createOrganization method for 'Organization'
definition):
callback(organizationsList, sequenceId, true)
.
- Parameters:
- {Function} callback
- The callback function called with the returned organizations list. (See HTTPFabricConnection for a callback description). Callback object type: Security.Organization[].
getUsers(callback)
Asynchronously gets all the users registered in Fabric. If the
current user of this fabric connection doesn't have rights for it then an
exception is returned by the server. Otherwise the specified
callback(response, sequenceId, success)
function is called with 'success' equal to 'true' and 'response' equal to
the list of 'User' records returned by the server (see
SecurityManager#updateUser for 'User' class description):
callback(usersList, sequenceId, true)
.
- Parameters:
- {Function} callback
- The callback function called with the returned user records list. (See HTTPFabricConnection for a callback description). Callback object type: Security.User[].
getVCard(name, callback)
Asynchronously gets vcard for the specified user. If the current user
of this fabric connection doesn't have rights to get this user vcard or if
the user with the specified name doesn't exist in Fabric, then an
exception is returned by the server. If the user is found then the
specified
callback(response, sequenceId, success)
function is
called with 'success' equal to 'true' and 'response' equal to 'vCard'
object returned by the server.
- Parameters:
- {String} name
- The login name of the user, which vcard should be returned
- {Function} callback
- The callback function called with 'vCard' response. (See HTTPFabricConnection for a callback description). Callback object type: 'vCard' (see #setVCard).
listGroups(callback)
Asynchronously lists all the user groups registered in Fabric. If the
current user of this fabric connection doesn't have rights for it then an
exception is returned by the server. Otherwise the specified
callback(response, sequenceId, success)
function is called with 'success' equal to 'true' and 'response' equal to
the list of user group names returned by the server:
callback(groupNamesList, sequenceId, true)
.
- Parameters:
- {Function} callback
- The callback function called with the returned group names list. (See HTTPFabricConnection for a callback description). Callback object type: {String[]}.
listOrganizations(callback)
Asynchronously lists all the organizations registered in Fabric. If the
current user of this fabric connection doesn't have rights for it then an
exception is returned by the server. Otherwise the specified
callback(response, sequenceId, success)
function is called with 'success' equal to 'true' and 'response' equal to
the list of organization names returned by the server:
callback(organizationNamesList, sequenceId, true)
.
- Parameters:
- {Function} callback
- The callback function called with the returned organization names list. (See HTTPFabricConnection for a callback description). Callback object type: {String[]}.
listUsers(callback)
Asynchronously lists all the users registered in Fabric. If the
current user of this fabric connection doesn't have rights for it then an
exception is returned by the server. Otherwise the specified
callback(response, sequenceId, success)
function is called with 'success' equal to 'true' and 'response' equal to
the list of user names returned by the server:
callback(userNamesList, sequenceId, true)
.
- Parameters:
- {Function} callback
- The callback function called with the returned user names list. (See HTTPFabricConnection for a callback description). Callback object type: {String[]}.
lookupGroup(name, callback)
Asynchronously looks up the specified users group in Fabric. If the
current user of this fabric connection doesn't have rights to look up a
group or if the group with the specified name doesn't exist in Fabric,
then an exception is returned by the server. If the group is found then
the specified
callback(response, sequenceId, success)
function is called with 'success' equal to 'true' and 'response' equal to
Security.Group object returned by the server (see
SecurityManager#createGroup for 'Group' class description):
callback(group, sequenceId, true)
.
- Parameters:
- {String} name
- The name of the users group to be found
- {Function} callback
- The callback function called with the found group object or an exception. (See HTTPFabricConnection for a callback description). Callback object type: Security.Group.
lookupOrganization(name, callback)
Asynchronously looks up the specified organization in Fabric. If the
current user of this fabric connection doesn't have rights to look up an
organization or if the organization with the specified name doesn't exist
in Fabric, then an exception is returned by the server. If the
organization is found then the specified
callback(response, sequenceId, success)
function is called with 'success' equal to 'true' and 'response' equal to
'Organization' object returned by the server (see
SecurityManager#createOrganization for 'Organization' class
description): callback(organization, sequenceId, true)
.
- Parameters:
- {String} name
- The name of the organization to be found
- {Function} callback
- The callback function called with the found 'Organization' object. (See HTTPFabricConnection for a callback description). Callback object type: Security.Organization.
lookupUser(name, callback)
Asynchronously looks up the specified user in Fabric. If the current user
of this fabric connection doesn't have rights to look up a user or if the
user with the specified name doesn't exist in Fabric, then an exception
is returned by the server. If the user is found then the specified
callback(response, sequenceId, success)
function is called
with 'success' equal to 'true' and 'response' equal to 'User' object
returned by the server (see SecurityManager#updateUser for
'User' class description): callback(user, sequenceId, true)
.
- Parameters:
- {String} name
- The login name of the user to be found
- {Function} callback
- The callback function called with the found user object. (See HTTPFabricConnection for a callback description). Callback object type: Security.User.
removeUserFromGroup(userName, groupName, callback)
Asynchronously removes the specified user from the specified group in
Fabric. If the current user of this fabric connection doesn't have rights
for it or if the specified user or the group doesn't exist in Fabric, then
an exception is returned by the server. If this operation succeeds then
the specified
callback(response, sequenceId, success)
function is called with 'success' equal to 'true':
callback(null, sequenceId, true)
.
- Parameters:
- {String} userName
- The login name of the user to be removed from the specified group
- {String} groupName
- The name of the group from which the user should be removed
- {Function} callback
- The callback function called with 'null' response or an exception. (See HTTPFabricConnection for a callback description). Callback object type: {null}.
setGroupOrganization(groupName, organizationName, callback)
Asynchronously sets the specified organization for the specified group in
Fabric. If the current user of this fabric connection doesn't have rights
for it or if the specified group or the organization doesn't exist in
Fabric, then an exception is returned by the server. If the operation
succeeds then the specified
callback(response, sequenceId, success)
function is
called with 'success' equal to 'true':
callback(null, sequenceId, true)
.
- Parameters:
- {String} groupName
- The name of the users group, for which the specified organization should be set
- {String} organizationName
- The name of the organization which should be set for the group
- {Function} callback
- The callback function called with 'null' response or an exception. (See HTTPFabricConnection for a callback description). Callback object type: {null}.
setOrganizationDomain(organizationName, domain, callback)
Asynchronously sets the specified domain for the specified organization in
Fabric. If the current user of this fabric connection doesn't have rights
for it or if the specified organization doesn't exist in Fabric, then an
exception is returned by the server. If the operation succeeds then the
specified
callback(response, sequenceId, success)
function is
called with 'success' equal to 'true':
callback(null, sequenceId, true)
.
- Parameters:
- {String} organizationName
- The name of the organization which should be set for the user
- {String} domain
- The name of the domain to be set for the specified organization
- {Function} callback
- The callback function called with 'null' response or an exception. (See HTTPFabricConnection for a callback description). Callback object type: {null}.
setUserOrganization(userName, organizationName, callback)
Asynchronously sets the specified organization for the specified user in
Fabric. If the current user of this fabric connection doesn't have rights
for it or if the specified user or the organization doesn't exist in
Fabric, then an exception is returned by the server. If the operation
succeeds then the specified
callback(response, sequenceId, success)
function is
called with 'success' equal to 'true':
callback(null, sequenceId, true)
.
- Parameters:
- {String} userName
- The login name of the user, for which the specified organization should be set
- {String} organizationName
- The name of the organization which should be set for the user
- {Function} callback
- The callback function called with 'null' response or an exception. (See HTTPFabricConnection for a callback description). Callback object type: {null}.
setVCard(name, vcard, callback)
Asynchronously sets the specified user vcard. If the current user of this
fabric connection doesn't have rights to set this user vcard or if the
user with the specified name doesn't exist in Fabric, then an exception
is returned by the server. If the vcard is set then the specified
callback(response, sequenceId, success)
function is called
with 'success' equal to 'true':
callback(null, sequenceId, true)
.
- Parameters:
- {String} name
- The login name of the user, which vcard should be set
- {vCard} vcard
- The user vcard to be set.
vCard
class has the fileds shown in the following example:var vcard = { '@type' : 'vCard', FN : 'Full name', N : { FAMILY : 'Family name', GIVEN : 'Given name', MIDDLE : 'Middle name' }, NICKNAME : 'Nickname', URL : 'User webpage', BDAY : 'Birthday', ORG : { ORGNAME : 'Organization name', ORGUNIT : 'Organization unit' }, TITLE : 'Title', ROLE : 'Role', HomePhoneList : [ { HOME : '', WORK : null, VOICE : '', FAX : null, MSG : null, NUMBER : '123-45-67' } ], HomeAddress : [ { HOME : '', WORK : null, EXTADR : 'Extended address', EXTADD : 'Extended address', STREET : 'Street', LOCALITY : 'Locality', REGION : 'Region', PCODE : 'Postal code', CTRY : 'Country' } ], WorkPhoneList : [ { HOME : null, WORK : '', VOICE : '', FAX : null, MSG : null, NUMBER : '765-43-21' } ], WorkAddress : [ { HOME : null, WORK : '', EXTADR : 'Extended address', EXTADD : 'Extended address', STREET : 'Street', LOCALITY : 'Locality', REGION : 'Region', PCODE : 'Postal code', CTRY : 'Country' } ], HomeEmail : [ { HOME : '', PREF : '', INTERNET : '', USERID : 'user@home.com' } }, WorkEmail : [ { INTERNET : '', USERID : 'user@domain.com' } }, JABBERID : 'user@domain.com', DESC : 'StreamScape User', PHOTO : { TYPE : '', BINVAL : 'Base64-encoded image' } }
- {Function} callback
- The callback function called with 'null' response or an exception. (See HTTPFabricConnection for a callback description). Callback object type: {null}.
updateGroup(group, callback)
Asynchronously updates the specified userd group in Fabric. If the current
user of this fabric connection doesn't have rights to update this group or
if the group with the specified name doesn't exist in Fabric, then an
exception is returned by the server. If the group is updated then the
specified
callback(response, sequenceId, success)
function is
called with 'success' equal to 'true':
callback(null, sequenceId, true)
.
- Parameters:
- {Security.Group} group
- The users group information to be set. See SecurityManager#createGroup method for 'Group' definition.
- {Function} callback
- The callback function called with 'null' response or an exception. (See HTTPFabricConnection for a callback description). Callback object type: {null}.
updateOrganization(organization, callback)
Asynchronously updates the specified organization in Fabric. If the
current user of this fabric connection doesn't have rights to update
this organization or if the organization with the specified name doesn't
exist in Fabric, then an exception is returned by the server. If the
organization is updated then the specified
callback(response, sequenceId, success)
function is
called with 'success' equal to 'true':
callback(null, sequenceId, true)
.
- Parameters:
- {Security.Organization} organization
- The organization information to be set. See SecurityManager#createOrganization method for 'Organization' definition.
- {Function} callback
- The callback function called with 'null' response or an exception. (See HTTPFabricConnection for a callback description). Callback object type: {null}.
updateUser(user, callback)
Asynchronously updates the specified user in Fabric. If the current user
of this fabric connection doesn't have rights to update this user or if the
user with the specified name doesn't exist in Fabric, then an exception
is returned by the server. If the user is updated then the specified
callback(response, sequenceId, success)
function is called
with 'success' equal to 'true':
callback(null, sequenceId, true)
.
- Parameters:
- {Security.User} user
- The user information to be set. See Security.User class
for its methods description.
User
class has the fields shown in the following example:var user = { '@type' : 'User', name : { str : 'streamscape' }, password : 'secret', description : 'Fabric guest user', alias : 'nv', organization : { str : 'StreamScape Technologies' }, groups : [ { str : 'guests' } ], accessControlList : { '@type' : 'AccessControlList', operations : [ { '@type' : 'AccessControlOperation', value : 'CLIENT_RAISE_EVENT' } ] }, ldifRecord : 'cn=StreamScape User,ou=Developers,dc=streamscape,dc=com', sudoCapable : false, distinguishedEntity : false, attributes : { '@type' : 'map', firstname : 'StreamScape', lastname : 'Tech', age : '3', country : 'USA', interests : 'R&D' } }
- {Function} callback
- The callback function called with 'null' response or an exception. (See HTTPFabricConnection for a callback description). Callback object type: {null}.