Esempio n. 1
0
            public override bool CanExecute()
            {
                if (AsMember.IsOwner)
                {
                    return(true);
                }

                if (!MemberPermissions.Has(Permission.Administrator, Permission.ManageRoles))
                {
                    return(false);
                }

                var memberHighestRole = GetRoleWithHighestPriority(MemberRoles);

                if (AddedRole.Priority >= memberHighestRole.Priority)
                {
                    return(false);
                }

                if (!MemberPermissions.Has(Permission.Administrator) && !MemberPermissions.Has(AddedPermission))
                {
                    return(false);
                }

                return(true);
            }
Esempio n. 2
0
            public override bool CanExecute()
            {
                if (AsMember.IsOwner)
                {
                    return(true);
                }
                if (!MemberPermissions.Has(Permission.Administrator, Permission.ManageRoles))
                {
                    return(false);
                }

                var highestRole = GetRoleWithHighestPriority(MemberRoles);

                return(highestRole.Priority > AssignedRole.Priority);
            }