Esempio n. 1
0
        /// <inheritdoc/>
        int IRoleController.AddRole(RoleInfo role, bool addToExistUsers)
        {
            Requires.NotNull("role", role);

            var roleId = -1;

            if (provider.CreateRole(role))
            {
                this.AddMessage(role, EventLogController.EventLogType.ROLE_CREATED);
                if (addToExistUsers)
                {
                    this.AutoAssignUsers(role);
                }

                roleId = role.RoleID;

                this.ClearRoleCache(role.PortalID);

                EventManager.Instance.OnRoleCreated(new RoleEventArgs()
                {
                    Role = role
                });
            }

            return(roleId);
        }
Esempio n. 2
0
        /// <summary>
        /// This overload adds a role and optionally adds the info to the AspNet Roles
        /// </summary>
        /// <param name="objRoleInfo">The Role to Add</param>
        /// <returns>The Id of the new role</returns>
        public int AddRole(RoleInfo objRoleInfo)
        {
            int  roleId  = -1;
            bool success = provider.CreateRole(objRoleInfo.PortalID, ref objRoleInfo);

            if (success)
            {
                AutoAssignUsers(objRoleInfo);
                roleId = objRoleInfo.RoleID;
            }

            return(roleId);
        }
Esempio n. 3
0
        int IRoleController.AddRole(RoleInfo role, bool addToExistUsers)
        {
            Requires.NotNull("role", role);

            var roleId = -1;

            if (provider.CreateRole(role))
            {
                AddMessage(role, EventLogController.EventLogType.ROLE_CREATED);
                if (addToExistUsers)
                {
                    AutoAssignUsers(role);
                }
                roleId = role.RoleID;

                ClearRoleCache(role.PortalID);
            }

            return(roleId);
        }