示例#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);
 }
        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);
            }
        }
        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);
            }
        }