Module: AuthicUserMixin::InstanceMethods

Defined in:
app/models/authic_user_mixin.rb

Instance Method Summary collapse

Instance Method Details

#authic_dataObject



56
57
58
59
# File 'app/models/authic_user_mixin.rb', line 56

def authic_data
  authic_data_string = self.read_attribute(:authic_data)
  authic_data_string.blank? ? {} : JSON.load(authic_data_string)
end

#groupsObject



42
43
44
45
# File 'app/models/authic_user_mixin.rb', line 42

def groups
  groups_string = self.read_attribute(:groups)
  groups_string.blank? ? [] : groups_string.split(",")
end

#has_role(role_name) ⇒ Object



47
48
49
# File 'app/models/authic_user_mixin.rb', line 47

def has_role(role_name)
  self.roles.include? role_name
end

#in_group(group_name) ⇒ Object



38
39
40
# File 'app/models/authic_user_mixin.rb', line 38

def in_group(group_name)
  self.groups.include? group_name
end

#rolesObject



51
52
53
54
# File 'app/models/authic_user_mixin.rb', line 51

def roles
  roles_string = self.read_attribute(:roles)
  roles_string.blank? ? [] : roles_string.split(",")
end