/// <summary>
        /// Checks whether the current user is authorised to create the provided entity.
        /// </summary>
        /// <param name="entity">The entity to be created.</param>
        /// <returns>A value indicating whether the current user is authorised to create the provided entity.</returns>
        public override bool IsAuthorised(IEntity entity)
        {
            if (entity == null)
            {
                throw new ArgumentNullException("entity");
            }

            if (!RequireAuthorisation)
            {
                return(true);
            }

            if (!AuthenticationState.IsAuthenticated)
            {
                return(false);
            }

            if (!AuthenticationState.UserIsInRole("Administrator"))
            {
                return(false);
            }

            return(true);
        }
Ejemplo n.º 2
0
 public override bool IsAuthorised(string shortTypeName)
 {
     return(AuthenticationState.UserIsInRole("Administrator"));
 }
Ejemplo n.º 3
0
 public override bool IsAuthorised(IEntity entity)
 {
     return(AuthenticationState.UserIsInRole("Administrator"));
 }