/// <summary> /// Checks the specified permissions in the calling scope security context /// </summary> /// <param name="app">Non-null app context</param> /// <param name="permissions">Permission instances to check</param> /// <param name="caller">The caller name is derived from CallerMemebr compiler info</param> /// <param name="session">The caller session scope or null in which case an ambient caller scope will be used</param> /// <remarks> /// Use case: /// <code> /// app.Authroize(Permission.All(new A(), new B()); /// app.Authorize(new A().And(new B()).And(new C())); /// </code> /// </remarks> public static void Authorize(this IApplication app, IEnumerable <Permission> permissions, [CallerMemberName] string caller = null, Apps.ISession session = null) => Permission.AuthorizeAndGuardAction(app.NonNull(nameof(app)), permissions, caller, session ?? Ambient.CurrentCallSession);
/// <summary> /// Checks a single specified permission in the calling scope security context /// </summary> /// <param name="app">Non-null app context</param> /// <param name="permission">Permission instance to check</param> /// <param name="caller">The caller name is derived from CallerMemebr compiler info</param> /// <param name="session">The caller session scope or null in which case an ambient caller scope will be used</param> /// <remarks> /// Use case: /// <code> /// app.Authroize(new A()); /// </code> /// </remarks> public static void Authorize(this IApplication app, Permission permission, [CallerMemberName] string caller = null, Apps.ISession session = null) => Permission.AuthorizeAndGuardAction(app.NonNull(nameof(app)).SecurityManager, permission, caller, session ?? Ambient.CurrentCallSession);