Exemplo n.º 1
0
 private int InsertRoleAndAccess(int instanceId, SystemRoles systemRole, IEnumerable components, AccessLevel accessLevel)
 {
     var role = new Role
     {
         InstanceId = instanceId,
         RoleType = systemRole,
         RoleName = systemRole.GetDescription()
     };
     Db.Save(role);
     foreach (var component in components)
     {
         if ((int)component == (int)AccessComponent.None)
             continue;
         var componentsToRole = new ComponentRole
         {
             InstanceId = instanceId,
             AccessLevel = accessLevel,
             ComponentId = (int)component,
             RoleId = role.RoleId
         };
         Db.Save(componentsToRole);
     }
     return role.RoleId;
 }
Exemplo n.º 2
0
 public ComponentRole Update(ComponentRole componentsToRole)
 {
     componentsToRole.AccessLevel = AccessLevel;
     return componentsToRole;
 }