예제 #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;
 }
예제 #2
0
 public ComponentRole Update(ComponentRole componentsToRole)
 {
     componentsToRole.AccessLevel = AccessLevel;
     return componentsToRole;
 }