Class: Scrivito::Membership

Inherits:
Object
  • Object
show all
Defined in:
app/cms/scrivito/membership.rb

Overview

Represents a Membership of a User in a Workspace.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#roleString (readonly)

Note:

Currently the only available role is “owner”.

The role associated with this membership.

Returns:

  • (String)

    the name of the role



19
20
21
# File 'app/cms/scrivito/membership.rb', line 19

def role
  @role
end

#user_idString (readonly)

The User’s id

Returns:

  • (String)


11
12
13
# File 'app/cms/scrivito/membership.rb', line 11

def user_id
  @user_id
end

Instance Method Details

#userObject

Fetches and returns the User with the id #user_id. Uses the proc set in Configuration.find_user to fetch the user.

Returns:

  • The value returned by the proc set in Configuration.find_user.

  • An unknown user if no proc is set in Configuration.find_user or the proc returns a falsy value. The unknown user will have the id of the original user and no capabilities.

See Also:



33
34
35
# File 'app/cms/scrivito/membership.rb', line 33

def user
  User.find(user_id) || User.unknown_user(user_id)
end