-
Notifications
You must be signed in to change notification settings - Fork 68
User management and privileges
The user management is get through an instance of the class IUserManager
which provide users of the class IUser
.
A IUserManager
class must contains the following public fields :
interface IUserManager
{
getUserByName(name : string, callback : (error : Error, user : IUser) => void)
getDefaultUser(callback : (user : IUser) => void)
getUsers(callback : (error : Error, users : IUser[]) => void)
}
A IUser
class must contains the following public fields :
interface IUser
{
uid : string
isAdministrator : boolean
isDefaultUser : boolean
password : string
username : string
}
The IUserManager
class can get a user by name ; it can get the list of all users ; and it can get the default user.
The default user is the user which is given to an unauthentication user. This way, an unauthenticated user will have the privileges of the default user. If the server's option requireAuthentification
equals true
, the default user will not be used.
Thanks to the server's option userManager
, the user manager can be set with a custom instance. This way, you can create a user manager which, for instance, retrieve its users from a database.
The privileges of a user upon a resource is defined by the instance of the interface IPrivilegeManager
provided in the server's option privilegeManager
. This object provides a list of methods to tell the server that a resource is accessible by a user or if it is not.
Here is the interface IPrivilegeManager
:
interface IPrivilegeManager
{
canCreate : PrivilegeManagerMethod
canDelete : PrivilegeManagerMethod
canMove : PrivilegeManagerMethod
canRename : PrivilegeManagerMethod
canAppend : PrivilegeManagerMethod
canWrite : PrivilegeManagerMethod
canRead : PrivilegeManagerMethod
canSource : PrivilegeManagerMethod // Allow to access to the source
// of a resource when it is
// requested by the 'source' header
canGetMimeType : PrivilegeManagerMethod
canGetSize : PrivilegeManagerMethod
canListLocks : PrivilegeManagerMethod
canSetLock : PrivilegeManagerMethod
canRemoveLock : PrivilegeManagerMethod
canGetAvailableLocks : PrivilegeManagerMethod
canGetLock : PrivilegeManagerMethod
canAddChild : PrivilegeManagerMethod
canRemoveChild : PrivilegeManagerMethod
canGetChildren : PrivilegeManagerMethod
canSetProperty : PrivilegeManagerMethod
canGetProperty : PrivilegeManagerMethod
canGetProperties : PrivilegeManagerMethod
canRemoveProperty : PrivilegeManagerMethod
canGetCreationDate : PrivilegeManagerMethod
canGetLastModifiedDate : PrivilegeManagerMethod
canGetWebName : PrivilegeManagerMethod
canGetType : PrivilegeManagerMethod
}
With :
type PrivilegeManagerCallback = (error : Error, hasAccess : boolean) => void;
type PrivilegeManagerMethod = (arg : MethodCallArgs, resource : IResource, callback : PrivilegeManagerCallback) => void
The request relative information (the user, the request, etc) are in the arg
parameter.
- Home
- Version 2
- Install
- Quick Start Guide
- Examples
- Concepts
- User concepts
- Server concepts
- Customizing
- Version 1 [Obsolete]
- Install
- Quick Start Guide
- Examples
- Features
- Resource concepts
- User concepts
- Server concepts
- Customizing
- Project