Dart DocumentationprincipalIdentity

Identity class

An identity providing a number of requirements.

class Identity extends Principled {

 // Shortcut to requirements.
 Set get provides => reqs;

 // User associated with this identity. Provided for implementations to use.
 dynamic user;

 // Key for this identity.
 final String key;

 /**
  * Creates a new identity for the given optional key.
  */
 Identity([this.key]);

 /**
  * Returns whether this identity has permission.
  */
 bool can(Permission permission) => contains(permission);

}

Extends

Principled > Identity

Constructors

new Identity([String key]) #

Creates a new identity for the given optional key.

Identity([this.key]);

Properties

final String key #

final String key;

final Set provides #

Set get provides => reqs;

final Set reqs #

inherited from Principled
final Set reqs = new Set();

var user #

dynamic user;

Methods

add(value) #

inherited from Principled

Adds a requirement value to this principled.

add(dynamic value) => reqs.add(new Requirement(value));

addMany(List<Dynamic> values) #

inherited from Principled

Adds many requirement values to this principled.

addMany(List<dynamic> values) => values.forEach(add);

bool can(Permission permission) #

Returns whether this identity has permission.

bool can(Permission permission) => contains(permission);

bool contains(Principled other) #

inherited from Principled

Returns whether the other principled is contained by this one.

bool contains(Principled other) => reqs.containsAll(other.reqs);