Class: Scrivito::Membership

Inherits:
Object
  • Object
show all
Defined in:
lib/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 role



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

def role
  @role
end

#user_idString (readonly)

The User’s id

Returns:

  • (String)


11
12
13
# File 'lib/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 abilities.

See Also:



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

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