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)); }
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); }