예제 #1
0
        public virtual PermissionGroupDefinition AddGroup(string name, string displayName = null)
        {
            if (Groups.ContainsKey(name))
            {
                throw new InvalidOperationException($"There is already an existing permission group with name: {name}");
            }

            return(Groups[name] = new PermissionGroupDefinition(name, displayName));
        }
예제 #2
0
        public virtual PermissionGroupDefinition GetGroup([NotNull] string name)
        {
            PermissionGroupDefinition group = GetGroupOrNull(name);

            if (group is null)
            {
                throw new InvalidOperationException($"Could not find a permission definition group with the given name: {name}");
            }

            return(group);
        }