Skip to content

lib-user 库参考 ​

原文: https://finproducts.atlassian.net/wiki/spaces/JIDD3/pages/34793488762/FIN+5.3.1+lib-user 中文整理基于 FIN 5.3.1

导读: 用户管理模块

以下为 API 参考,保留英文以便对照源码;目录已列出(英文标题便于检索);概述已尽量中译。


目录(导读) ​

  • lib
  • meta
  • tags
  • funcs
  • views
  • def
  • supertypes
  • userBackup()
  • userBackupCleanup(dateOrAge)
  • userBackupDelete(ts)
  • userBackups()
  • userCommit(diffs)
  • userCur()
  • userIsProjAccessible(user, projName)
  • userLastLogin(username)
  • userMfaStatus(userRefs)
  • userMfaTotpReset(userRefs)
  • userRead(filterExpr, checked: true)
  • userReadAll(filterExpr: null, optsExpr: null)
  • userReadById(id, checked: true)
  • userSetPassword(username, password)

概述(中译) ​

用户管理模块


API 正文(英文) ​

tags ​

appAccessRestricts the set of accessible apps
arcAccessFilterRestricts access to arc document records
arcUnassignableHides the user from assignedTo field on arc documents
arcWriteAccessDefines write permissions for arc documents
defUriHost relative URI to redirect the user upon login
defViewThe name of the view that should be the default for a user or project
fileAccessList of directory Uris that a non-su user has read-write access to
fileAccessReadOnlyList of directory Uris that a non-su user has read-only access to
notificationsThe set of notifications a user is subscribed to
pointOverrideAccessDefines levels which may be overridden by the user for writable points
projAccessFilterApplied to users to defines access to projects
reportCanSaveEnables an operator user to save reports to the database
siteAccessFilterRestricts access to sites
topicsEmailDigestClassic legacy support
topicsEmailImmediateClassic legacy support
userUser account
userAccessFilterRestricts which users are visible
userAllowList of function names to allow on this user
userAuthDefines how a user authenticates
userFailedLoginsHow many failed login attempts the user has made since last successful login
userLockOutIndicates the user is locked out because of too many failed login attempts
userMfaIndicates the user requires multifactor authentication and which multifactor authentication method is configured
userProtoA user prototype
userProtoNameUser prototype name
userProtoRefUser prototype to apply to a user
userRefReference to user entity
userRoleIndicates what permissions and access rights the user has

funcs ​

userBackupAsynchronously kick off a new backup for user database
userBackupCleanupDelete all user database backups older than the given duration or date
userBackupDeleteDelete a user database backup file by its timestamp
userBackupsList all the user database backups
userCommitCommit one or more diffs to the user database
userCurRead user rec Dict for current session user
userIsProjAccessibleReturn if the given user has access to the project as configured by projAccessFilter
userLastLoginGet information about the last successful login for the user with the given username
userMfaStatusCheck if MFA is required and if user is enrolled
userMfaTotpResetClear the stored Totp MFA enrollment configuration
userReadRead a rec Dict from the user db by filter
userReadAllRead a Grid of recs from the user db by filter
userReadByIdRead a rec Dict from the user db by id
userSetPasswordUpdate password of the given user

views ​

userBackupsExecute and manage backups of the local user database
userPrefsManage preferences for the current user
userProtosManage user prototypes in the local user database
userSettingsSettings for the user system module
usersManage the local user database


def ​

appAccess ​

Restricts the set of accessible apps. This tag is formatted as a list of comma-separated app names.


meta ​

defappAccess
isstr
liblib:user
tagOnuser, userProto
uiInputui::AppAccessInput

supertypes ​

valData value type
scalarScalar is an atomic value kind
strUnicode string of characters


def ​

arcAccessFilter ​

Restricts access to arc document records.


meta ​

defarcAccessFilter
isfilterStr
liblib:user
tagOnuser, userProto

supertypes ​

valData value type
scalarScalar is an atomic value kind
strUnicode string of characters
filterStrHaystack filter string


def ​

arcUnassignable ​

Hides the user from assignedTo field on arc documents.


meta ​

defarcUnassignable
ismarker
liblib:user
tagOnuser, userProto

supertypes ​

markerMarker labels a dict with typing information


def ​

arcWriteAccess ​

Defines write permissions for arc documents. This tag is formatted as a comma-separated list of the following permissions:

  • "new": can create a new arc document
  • "edit": can edit the record meta of an existing arc document
  • "move": can move an document to a new project based on arcOn
  • "remove": can trash or remove documents from database
  • "newPart": can add a new part/reply to an arc document
  • "editPart": can edit existing parts/replies of an arc document

If not configured, then users default as follows:

  • su: "new, edit, move, remove, newPart, editPart" (all permissions)
  • admin: "new, edit, move, remove, newPart" (no editPart)
  • op: "" (none)

meta ​

defarcWriteAccess
isstr
liblib:user
tagOnuser, userProto
uiInputuiMisc::ArcWriteAccessInput

supertypes ​

valData value type
scalarScalar is an atomic value kind
strUnicode string of characters


def ​

defUri ​

Host relative URI to redirect the user upon login. This URI is used only if the user is logging into root at "/". Typically this tag is configured to a project home page such as "/ui/myProj".


meta ​

defdefUri
isuri
liblib:user
tagOnuser, userProto

supertypes ​

valData value type
scalarScalar is an atomic value kind
uriUniversal resource identifier


def ​

defView ​

The name of the view that should be the default for a user or project. When a user opens a project, this will be the view that loads by default. You can configure project-specific default views by tagging a user with <projName>DefView instead; this will override any defView specified on the user or project. You can also set this tag on the project's uiMeta record and this will be used as the default view for the project if a user doesn't have one configured.


meta ​

defdefView
isstr
liblib:user
tagOnuser, userProto

supertypes ​

valData value type
scalarScalar is an atomic value kind
strUnicode string of characters


def ​

fileAccess ​

List of directory Uris that a non-su user has read-write access to. If the path is relative, then the user has access to that path under every mount.


meta ​

deffileAccess
islist
liblib:user
ofuri
tagOnuser, userProto

supertypes ​

valData value type
listOrdered list of zero or more values


def ​

fileAccessReadOnly ​

List of directory Uris that a non-su user has read-only access to. If the path is relative, then the user has read access to that path under every mount.


meta ​

deffileAccessReadOnly
islist
liblib:user
ofuri
tagOnuser, userProto

supertypes ​

valData value type
listOrdered list of zero or more values


def ​

func:userBackup ​

userBackup() ​

Asynchronously kick off a new backup for user database. Return a future to track completion of the backup. The future's result value is subject to change.


meta ​

confirm
deffunc:userBackup
disKeyui::backup
isfunc
liblib:user
nameuserBackup
su✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function


def ​

func:userBackupCleanup ​

userBackupCleanup(dateOrAge) ​

Delete all user database backups older than the given duration or date.


meta ​

admin✓
deffunc:userBackupCleanup
isfunc
liblib:user
nameuserBackupCleanup

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function


def ​

func:userBackupDelete ​

userBackupDelete(ts) ​

Delete a user database backup file by its timestamp.


meta ​

admin✓
confirm
deffunc:userBackupDelete
disKeyui::delete
isfunc
liblib:user
multi✓
nameuserBackupDelete
select✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function


def ​

func:userBackups ​

userBackups() ​

List all the user database backups


meta ​

deffunc:userBackups
isfunc
liblib:user
nameuserBackups
su✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function


def ​

func:userCommit ​

userCommit(diffs) ​

Commit one or more diffs to the user database. The argument may be one of the following:

  • result of diff()
  • list of diff() to commit multiple diffs at once

If one diff is passed, return the new record. If a list of diffs is passed, return a list of new records.

When creating a new user the following tags must be specified:

  • id - Must be @<username>
  • user
  • username - Must match the id.
  • tz
  • userRole

If the userAuth tag is not specified, a "dummy" SCRAM configuration will be be generated, but the user will not be able to log in until a password is set. This can be done in Axon using userSetPassword(). Otherwise, you will need to reset their password in the user manager, or if email reset is enabled the user can do it from the login page using the forgot my password feature.

Examples:

// add a new user
userTags: {id:@bach, user, username:"bach", userRole:"op", tz:"New_York"}
newRec: userCommit(diff(null, userTags, {add}))

// update the appAccess tag on all operator users
userReadAll(user and userRole=="op")
  .toRecList
  .map(r => diff(r, {appAccess:"energy,his"}))
  .userCommit

// remove all disabled users
userReadAll(user and disabled)
  .toRecList
  .map(r => diff(r, null, {remove}))
  .userCommit

meta ​

deffunc:userCommit
isfunc
liblib:user
nameuserCommit
su✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function


def ​

func:userCur ​

userCur() ​

Read user rec Dict for current session user


meta ​

deffunc:userCur
isfunc
liblib:user
nameuserCur

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function


def ​

func:userIsProjAccessible ​

userIsProjAccessible(user, projName) ​

Return if the given user has access to the project as configured by projAccessFilter. The user must be a Dict and the projName must be a Str name. Also see User.isProjAccessible. Requires su permission.


meta ​

deffunc:userIsProjAccessible
isfunc
liblib:user
nameuserIsProjAccessible
su✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function


def ​

func:userLastLogin ​

userLastLogin(username) ​

Get information about the last successful login for the user with the given username. The Dict will contains the following tags:

  • ts: the timestamp of the last login
  • remoteAddr: the remote IP address the user logged in from
  • userAgent: the user-agent used to login (if known)

Return null if no login information is found.


meta ​

deffunc:userLastLogin
isfunc
liblib:user
nameuserLastLogin
su✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function


def ​

func:userMfaStatus ​

userMfaStatus(userRefs) ​

Check if MFA is required and if user is enrolled.

Examples:

// check a user MFA status
userMfaStatus(@userId)

userReadAll(<filter>).userMfaStatus

meta ​

deffunc:userMfaStatus
isfunc
liblib:user
nameuserMfaStatus
su✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function


def ​

func:userMfaTotpReset ​

userMfaTotpReset(userRefs) ​

Clear the stored Totp MFA enrollment configuration. This will force the user to re-enroll their authenticator app.

Examples:

// reset a user totp enrollment
userMfaTotpReset(@userId)
userReadById(@userID).userMfaTotpReset

// reset multiple user's totp enrollment
userReadAll(<filter>).userMfaTotpReset

meta ​

deffunc:userMfaTotpReset
isfunc
liblib:user
nameuserMfaTotpReset
su✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function


def ​

func:userRead ​

userRead(filterExpr, checked: true) ​

Read a rec Dict from the user db by filter. If context user is not su, then the user being read must be accessible to the current context project.


meta ​

admin✓
deffunc:userRead
isfunc
liblib:user
nameuserRead

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function


def ​

func:userReadAll ​

userReadAll(filterExpr: null, optsExpr: null) ​

Read a Grid of recs from the user db by filter. If the context user is not su, then only users with access to the to the current context project are returned.


meta ​

admin✓
deffunc:userReadAll
isfunc
liblib:user
nameuserReadAll

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function


def ​

func:userReadById ​

userReadById(id, checked: true) ​

Read a rec Dict from the user db by id. If context user is not su, then the user being read must be accessible to the current context project.


meta ​

admin✓
deffunc:userReadById
isfunc
liblib:user
nameuserReadById

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function


def ​

func:userSetPassword ​

userSetPassword(username, password) ​

Update password of the given user.


meta ​

deffunc:userSetPassword
isfunc
liblib:user
nameuserSetPassword
su✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function


def ​

notifications ​

The set of notifications a user is subscribed to


meta ​

defnotifications
islist
liblib:user
ofstr
tagOnuser
uiInputui::NotificationsInput

supertypes ​

valData value type
listOrdered list of zero or more values


def ​

pointOverrideAccess ​

Defines levels which may be overridden by the user for writable points. This value is a comma separated string 1, 8, and def. For example to allow writes to level 8 and default then set to "8,def". If not configured, then users default as follows:

  • su: "1, 8, def"
  • admin: "8, def"
  • op: ""

meta ​

defpointOverrideAccess
isstr
liblib:user
tagOnuser, userProto
uiInputuiMisc::PointOverrideAccessInput

supertypes ​

valData value type
scalarScalar is an atomic value kind
strUnicode string of characters


def ​

projAccessFilter ​

Applied to users to defines access to projects. See Security.


meta ​

defprojAccessFilter
isfilterStr
liblib:user
tagOnuser, userProto
uiInputui::ProjAccessFilterInput

supertypes ​

valData value type
scalarScalar is an atomic value kind
strUnicode string of characters
filterStrHaystack filter string


def ​

reportCanSave ​

Enables an operator user to save reports to the database. Admin users always have permission to save reports.


meta ​

defreportCanSave
ismarker
liblib:user
tagOnuser, userProto

supertypes ​

markerMarker labels a dict with typing information


def ​

siteAccessFilter ​

Restricts access to sites.


meta ​

defsiteAccessFilter
isfilterStr
liblib:user
tagOnuser, userProto

supertypes ​

valData value type
scalarScalar is an atomic value kind
strUnicode string of characters
filterStrHaystack filter string


def ​

topicsEmailDigest ​

Classic legacy support. Applied to indicate which topics the user is subscribed to for daily digest email delivery. The value must be a comma separated list of topic record ids such as "@a-1,@b-2".


meta ​

deftopicsEmailDigest
isstr
liblib:user
tagOnuser, userProto
uiInputui::TopicsEmailInput

supertypes ​

valData value type
scalarScalar is an atomic value kind
strUnicode string of characters


def ​

topicsEmailImmediate ​

Classic legacy support. Applied to indicate which topics the user is subscribed to for immediate email delivery. The value must be a comma separated list of topic record ids such as "@a-1,@b-2".


meta ​

deftopicsEmailImmediate
isstr
liblib:user
tagOnuser, userProto
uiInputui::TopicsEmailInput

supertypes ​

valData value type
scalarScalar is an atomic value kind
strUnicode string of characters


def ​

user ​

User account. Users are managed at the host level in the user database.


meta ​

defuser
iconuser
isentity
liblib:user
mandatory✓

supertypes ​

markerMarker labels a dict with typing information
entityTop-level dicts with a unique identifier

tags ​

appAccessRestricts the set of accessible apps
arcAccessFilterRestricts access to arc document records
arcUnassignableHides the user from assignedTo field on arc documents
arcWriteAccessDefines write permissions for arc documents
createdThe timestamp when entity was created
defUriHost relative URI to redirect the user upon login
defViewThe name of the view that should be the default for a user or project
disDisplay name for an entity
disabledIndicates the entity is in a disabled state
emailAn email address
expiresExpiration date
fileAccessList of directory Uris that a non-su user has read-write access to
fileAccessReadOnlyList of directory Uris that a non-su user has read-only access to
idDefines the unique identifier of an entity in system using a ref value type
notificationsThe set of notifications a user is subscribed to
pointOverrideAccessDefines levels which may be overridden by the user for writable points
projAccessFilterApplied to users to defines access to projects
reportCanSaveEnables an operator user to save reports to the database
siteAccessFilterRestricts access to sites
topicsEmailDigestClassic legacy support
topicsEmailImmediateClassic legacy support
tzTimezone identifier from standard timezone database
userAccessFilterRestricts which users are visible
userAllowList of function names to allow on this user
userAuthDefines how a user authenticates
userFailedLoginsHow many failed login attempts the user has made since last successful login
userLockOutIndicates the user is locked out because of too many failed login attempts
userMfaIndicates the user requires multifactor authentication and which multifactor authentication method is configured
userProtoRefUser prototype to apply to a user
userRoleIndicates what permissions and access rights the user has
usernameUsername for an authentication account


def ​

userAccessFilter ​

Restricts which users are visible.


meta ​

defuserAccessFilter
isfilterStr
liblib:user
tagOnuser, userProto

supertypes ​

valData value type
scalarScalar is an atomic value kind
strUnicode string of characters
filterStrHaystack filter string


def ​

userAllow ​

List of function names to allow on this user. This tag grants functions marked su or admin to users who would normally not have permission to call those functions.


meta ​

defuserAllow
islist
liblib:user
ofstr
tagOnuser, userProto
uiInputuiDev::AdminFuncNameListInput

supertypes ​

valData value type
listOrdered list of zero or more values


def ​

userAuth ​

Defines how a user authenticates.

See docSkySpark


meta ​

defuserAuth
isdict
liblib:user
tagOnuser
uiInputui::UserAuthInput

supertypes ​

valData value type
dictMap of name/value tag pairs


def ​

userFailedLogins ​

How many failed login attempts the user has made since last successful login.


meta ​

defuserFailedLogins
isnumber
liblib:user
tagOnuser
transient✓

supertypes ​

valData value type
scalarScalar is an atomic value kind
numberInteger or floating point numbers annotated with an optional unit


def ​

userLockOut ​

Indicates the user is locked out because of too many failed login attempts. When this tag is present, the user cannot login.


meta ​

defuserLockOut
ismarker
liblib:user
tagOnuser

supertypes ​

markerMarker labels a dict with typing information


def ​

userMfa ​

Indicates the user requires multifactor authentication and which multifactor authentication method is configured.


meta ​

defuserMfa
isdict
liblib:user
tagOnuser, userProto
uiInputui::UserMfaInput

supertypes ​

valData value type
dictMap of name/value tag pairs


def ​

userProto ​

A user prototype. These tags can be used to organize common tags that should be used across multiple users. The tags will be merged into the user record.


meta ​

defuserProto
iconuser
isentity
liblib:user
mandatory✓

supertypes ​

markerMarker labels a dict with typing information
entityTop-level dicts with a unique identifier

tags ​

appAccessRestricts the set of accessible apps
arcAccessFilterRestricts access to arc document records
arcUnassignableHides the user from assignedTo field on arc documents
arcWriteAccessDefines write permissions for arc documents
defUriHost relative URI to redirect the user upon login
defViewThe name of the view that should be the default for a user or project
disDisplay name for an entity
fileAccessList of directory Uris that a non-su user has read-write access to
fileAccessReadOnlyList of directory Uris that a non-su user has read-only access to
idDefines the unique identifier of an entity in system using a ref value type
ldapUserProtoAttrValThe value of this tag is used to help the LDAP mod determine which user prototypes an LDAP user maps to
pointOverrideAccessDefines levels which may be overridden by the user for writable points
projAccessFilterApplied to users to defines access to projects
reportCanSaveEnables an operator user to save reports to the database
samlSsoUserProtoAttrValThe value of this tag is used to help the SAML SSO auth mod determine which user prototypes a SAML SSO user matches
siteAccessFilterRestricts access to sites
topicsEmailDigestClassic legacy support
topicsEmailImmediateClassic legacy support
tzTimezone identifier from standard timezone database
userAccessFilterRestricts which users are visible
userAllowList of function names to allow on this user
userMfaIndicates the user requires multifactor authentication and which multifactor authentication method is configured
userProtoNameUser prototype name
userRoleIndicates what permissions and access rights the user has


def ​

userProtoName ​

User prototype name.


meta ​

defuserProtoName
isstr
liblib:user
tagOnuserProto

supertypes ​

valData value type
scalarScalar is an atomic value kind
strUnicode string of characters


def ​

userProtoRef ​

User prototype to apply to a user


meta ​

defuserProtoRef
isref
liblib:user
ofuserProto
tagOnuser

supertypes ​

valData value type
scalarScalar is an atomic value kind
refReference to an entity


def ​

userRef ​

Reference to user entity


meta ​

defuserRef
isref
liblib:user
ofuser
tagOnuserCertificate

supertypes ​

valData value type
scalarScalar is an atomic value kind
refReference to an entity


def ​

userRole ​

Indicates what permissions and access rights the user has. See docSkySpark


meta ​

defuserRole
enumSee below
isstr
liblib:user
tagOnuser, userProto

enum ​

opthe user is an operator
adminthe user is an administrator
suthe user is a super user

supertypes ​

valData value type
scalarScalar is an atomic value kind
strUnicode string of characters


def ​

view:userBackups ​

Execute and manage backups of the local user database


meta ​

appNameusers
defview:userBackups
disKeyui::backups
iconview
isview
liblib:user
order800
su✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
viewFresco UI view

src ​

view:   {inherit:"table"}
backup: {action:"userBackup"}
delete: {action:"userBackupDelete"}
data:   {expr:"userBackups()"}


def ​

view:userPrefs ​

Manage preferences for the current user


meta ​

defview:userPrefs
disKeyui::preferences
iconview
isview
liblib:user

supertypes ​

featureFeature namespace of definitions formatted as feature:name
viewFresco UI view

src ​

view:   {inherit:"form"}
submit: {action:"userPrefsFormSave" refresh}
reset:  {action:"userPrefsFormReset" refresh confirm:{icon:"warn" disKey:"ui::userPrefsResetConfirm" detailsKey:"ui::userPrefsResetConfirmDetails"} }
data:   {expr:"userPrefsFormLoad()"}


def ​

view:userProtos ​

Manage user prototypes in the local user database


meta ​

appNameusers
defview:userProtos
defNameuserProto
disKeyui::protos
iconview
isview
liblib:user
order120
su✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
viewFresco UI view

src ​

view:     {inherit:"table"}
search:   {input var kind:"Str" defVal:""}
new:      {action:"userProtoNew"}
edit:     {action:"userProtoEdit" select multi}
dup:      {action:"userProtoDup"}
delete:   {action:"userProtoDelete"}
data:     {expr:"userProtoReadAll(userProto, { search:{{search}} })"}


def ​

view:userSettings ​

Settings for the user system module


meta ​

appNamesettings
defview:userSettings
disKeyui::user
iconview
isview
liblib:user
su✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
viewFresco UI view

src ​

view:   {inherit:"form"}
submit: {action:"hostCommit"}
data:   {expr:"hostSettings(\"user\")"}


def ​

view:users ​

Manage the local user database


meta ​

appNameusers
defview:users
defNameuser
disKeyui::users
iconview
isview
liblib:user
order100
su✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
viewFresco UI view

src ​

view:       {inherit:"table"}
search:     {input var kind:"Str" defVal:""}
new:        {action:"userNew" onCommit:"uiMisc::UserWizard.onCommit"}
edit:       {action:"userEdit" select multi onCommit:"uiMisc::UserWizard.onCommit"}
reset:      {disKey:"ui::resetPass" action:"uiMisc::UserWizard.openReset" select}
forceReset: {action:"userForceReset" disKey:"ui::forceResetPass" select multi}
unlock:     {action:"userUnlock" disKey:"ui::unlock" select multi}
delete:     {action:"userDelete"}
apply:      {action:"userEffective"}
activity:   {action:"userActivity"}
data:       {expr:"userReadAll(user, { search:{{search}} })"}