/// <summary> Checks whether this command may be called by players of a given rank. </summary>
 public bool CanBeCalledBy([NotNull] Rank rank)
 {
     if (rank == null)
     {
         throw new ArgumentNullException("rank");
     }
     return(Permissions == null ||
            Permissions.All(rank.Can) ||
            AnyPermission && Permissions.Any(rank.Can));
 }
        /// <summary> Checks whether this command may be called by players of a given rank. </summary>
        public bool CanBeCalledBy([NotNull] Rank rank, bool isConsole)
        {
            if (rank == null && !isConsole)
            {
                throw new ArgumentNullException("rank");
            }

            if (isConsole)
            {
                return(true);
            }
            return(Permissions == null ||
                   Permissions.All(rank.Can) ||
                   AnyPermission && Permissions.Any(rank.Can));
        }
Exemple #3
0
        public bool IsSatisfied(PermissionDependencyContext context)
        {
            var session = context.ServiceProvider.GetRequiredService <IUserSession>();

            return(RequiresAll ? Permissions.All(session.IsGranted) : Permissions.Any(session.IsGranted));
        }