/// <summary>
        /// Creates a new child permission group under this group.
        /// </summary>
        /// <param name="name">Unique name of the group</param>
        /// <param name="displayName">Display name of the group</param>
        /// <returns>Newly created child permission group object</returns>
        public PermissionGroup CreateChildGroup(string name, ILocalizableString displayName)
        {
            var childGroup = new PermissionGroup(name, displayName)
            {
                Parent = this
            };

            _children.Add(childGroup);
            return(childGroup);
        }
            public PermissionGroup CreateRootGroup(string name, ILocalizableString displayName)
            {
                if (_rootGroups.ContainsKey(name))
                {
                    throw new AbpInitializationException(
                              string.Format(
                                  "There is already a root permission group named '{0}'. Try to get it using GetRootGroupOrNull method",
                                  name));
                }

                return(_rootGroups[name] = new PermissionGroup(name, displayName));
            }
Beispiel #3
0
        /// <summary>
        /// Adds permissions to dictionary in given group and it's all child groups recursively.
        /// </summary>
        public void AddGroupPermissionsRecursively(PermissionGroup permissionGroup)
        {
            //Add permissions in given group
            foreach (var permission in permissionGroup.Permissions)
            {
                AddPermissionRecursively(permission);
            }

            //Add permissions in all child groups recursively
            foreach (var childGroup in permissionGroup.Children)
            {
                AddGroupPermissionsRecursively(childGroup);
            }
        }
 /// <summary>
 /// Creates a new child permission group under this group.
 /// </summary>
 /// <param name="name">Unique name of the group</param>
 /// <param name="displayName">Display name of the group</param>
 /// <returns>Newly created child permission group object</returns>
 public PermissionGroup CreateChildGroup(string name, ILocalizableString displayName)
 {
     var childGroup = new PermissionGroup(name, displayName) { Parent = this };
     _children.Add(childGroup);
     return childGroup;
 }
            public PermissionGroup CreateRootGroup(string name, ILocalizableString displayName)
            {
                if (_rootGroups.ContainsKey(name))
                {
                    throw new AbpInitializationException(
                        string.Format(
                            "There is already a root permission group named '{0}'. Try to get it using GetRootGroupOrNull method",
                            name));
                }

                return _rootGroups[name] = new PermissionGroup(name, displayName);
            }