agents

User profile and permissions (user or email author)

class AgentCollection()

Agents collection

Extends

app.models.base.BaseCollection()

AgentCollection.app.models.agents.AgentCollection.model

The model

Type

AgentModel

AgentCollection.app.models.agents.AgentCollection.url
Type

string

AgentCollection.getById(id)

Returns the user by his/her id, or return the unknown user

Arguments
  • id (Number) –

Return type

Object

AgentCollection.getUnknownUser()

Returns the unknown user object

Return type

Object

class AgentModel()

Agent model Frontend model for assembl.models.auth.AgentProfile

Extends

app.models.base.BaseModel()

AgentModel.app.models.agents.AgentModel.permissions

The list with all user’s permissions This is usefull only for the logged user.

Type

[ ‘Array’ ].<string>

AgentModel.app.models.agents.AgentModel.urlRoot
Type

string

AgentModel.can(permission)
Arguments
  • permission (String) –

Return type

Boolean

AgentModel.fetchPermissions()

Load permissions from database

AgentModel.fetchPermissionsFromScriptTag([id='permissions-json'])

Load the permissions from script tag and populates this.permissions

Arguments
  • id (string) – The script tag id

AgentModel.getAvatarColor()

Returns the avatar’s color

Return type

string

AgentModel.getAvatarUrl([size=44])

return the avatar’s url

Arguments
  • size (number) – The avatar size

Return type

string

AgentModel.getRolesMissingMessageForPermission(permission, discussion, reroute_relative_url)

A text message designed to replace X in the question “You cannot perform this operation because X”

Arguments
  • permission (String) –

  • discussion (Number) –

  • reroute_relative_url (String) –

Return type

string

AgentModel.hasPermission(permission)

Checks if user has permission

Arguments
  • permission (string) – The permission name

Returns

True if the user has the given permission

Return type

boolean

AgentModel.isUnknownUser()

Returns true if the user is an unknown user

Return type

Boolean

AgentModel.validate()

Validate the model attributes