예제 #1
0
 public void AddRoleToAccount(Permission role)
 {
     roles.Add(role);
 }
예제 #2
0
 public void AddPermissionToAccount(Permission perm)
 {
     permissions.Add(perm);
 }
예제 #3
0
 public void AddPermissionToRole(Permission perm)
 {
     permissions.Add(perm);
 }
예제 #4
0
        private void LoadRolesOfAccount()
        {
            List<IDAndName> roles1 = accountFunctions.GetRolesAccountHas(currentAccount.Id);
            foreach (IDAndName role in roles1)
            {
                Permission p = new Permission(role.id, role.name, true);
                currentAccount.AddRoleToAccount(p);
            }

            List<IDAndName> roles2 = accountFunctions.GetRolesAccountHasNot(currentAccount.Id);
            foreach (IDAndName role in roles2)
            {
                Permission p = new Permission(role.id, role.name, false);
                currentAccount.AddRoleToAccount(p);
            }
        }
예제 #5
0
        private void LoadPermissionsOfAccount()
        {
            List<IDAndName> perm1 = accountFunctions.GetGivenPermissionsOfAccount(currentAccount.Id);
            foreach (IDAndName perm in perm1)
            {
                Permission p = new Permission(perm.id, perm.name, true);
                currentAccount.AddPermissionToAccount(p);
            }

            List<IDAndName> perm2 = accountFunctions.GetNotGivenPermissionsOfAccount(currentAccount.Id);
            foreach (IDAndName perm in perm2)
            {
                Permission p = new Permission(perm.id, perm.name, false);
                currentAccount.AddPermissionToAccount(p);
            }
        }
예제 #6
0
        private void LoadPermissionsOfRole()
        {
            List<IDAndName> perm1 = roleFunctions.GetGivenPermissionsOfRole(currentRole.id);
            foreach (IDAndName perm in perm1)
            {
                Permission p = new Permission(perm.id, perm.name, true);
                currentRole.AddPermissionToRole(p);
            }

            List<IDAndName> perm2 = roleFunctions.GetNotGivenPermissionsOfRole(currentRole.id);
            foreach (IDAndName perm in perm2)
            {
                Permission p = new Permission(perm.id, perm.name, false);
                currentRole.AddPermissionToRole(p);
            }
        }