1- using AdvancedTodoList . Application . Services . Definitions ;
2- using AdvancedTodoList . Core . Models ;
1+ using AdvancedTodoList . Core . Models ;
32using AdvancedTodoList . Core . Models . TodoLists . Members ;
43
54namespace AdvancedTodoList . Application . Services . Definitions . Auth ;
@@ -9,61 +8,61 @@ namespace AdvancedTodoList.Application.Services.Definitions.Auth;
98/// </summary>
109public interface IPermissionsChecker
1110{
12- /// <summary>
13- /// Asynchronously checks whether the user is a member of the to-do list with
14- /// specified ID.
15- /// </summary>
16- /// <param name="context">To-do list context.</param>
17- /// <returns>
18- /// <see langword="true" /> if user is a member of the list; otherwise <see langword="false" />.
19- /// </returns>
20- Task < bool > IsMemberOfListAsync ( TodoListContext context ) ;
11+ /// <summary>
12+ /// Asynchronously checks whether the user is a member of the to-do list with
13+ /// specified ID.
14+ /// </summary>
15+ /// <param name="context">To-do list context.</param>
16+ /// <returns>
17+ /// <see langword="true" /> if user is a member of the list; otherwise <see langword="false" />.
18+ /// </returns>
19+ Task < bool > IsMemberOfListAsync ( TodoListContext context ) ;
2120
22- /// <summary>
23- /// Asynchronously checks whether the user is a member of the to-do list and
24- /// has a permission defined by the funciton <paramref name="permission"/>.
25- /// </summary>
26- /// <param name="context">To-do list context.</param>
27- /// <param name="permission">Function that should return <see langword="true"/> if user has required permission.</param>
28- /// <returns>
29- /// <see langword="true" /> if user is a member of the list and has required permission;
30- /// otherwise <see langword="false" />.
31- /// </returns>
32- Task < bool > HasPermissionAsync ( TodoListContext context , Func < RolePermissions , bool > permission ) ;
21+ /// <summary>
22+ /// Asynchronously checks whether the user is a member of the to-do list and
23+ /// has a permission defined by the funciton <paramref name="permission"/>.
24+ /// </summary>
25+ /// <param name="context">To-do list context.</param>
26+ /// <param name="permission">Function that should return <see langword="true"/> if user has required permission.</param>
27+ /// <returns>
28+ /// <see langword="true" /> if user is a member of the list and has required permission;
29+ /// otherwise <see langword="false" />.
30+ /// </returns>
31+ Task < bool > HasPermissionAsync ( TodoListContext context , Func < RolePermissions , bool > permission ) ;
3332
34- /// <summary>
35- /// Asynchronously checks whether the user can touch an entity.
36- /// </summary>
37- /// <remarks>
38- /// This method firstly checks whether <paramref name="entity"/> implements <see cref="IHasOwner"/>
39- /// interface and if yes, checks if the user is the owner of the entity and is a member of the to-do list;
40- /// otherwise the method checks if user has the permission defined by the function <paramref name="permission"/>.
41- /// </remarks>
42- /// <typeparam name="TEntity">Type of the entity.</typeparam>
43- /// <typeparam name="TKey">Type of the unique identifier used by the entity.</typeparam>
44- /// <param name="context">To-do list context.</param>
45- /// <param name="entity">ID of the entity.</param>
46- /// <param name="permission">Function that should return <see langword="true"/> if user has required permission.</param>
47- /// <returns>
48- /// <see langword="true"/> if user is either an owner of the entity and a member of a to-do list,
49- /// or he/she/they has permission defined by <paramref name="permission"/>; otherwise <see langword="false" />.
50- /// </returns>
51- Task < bool > CanTouchEntityAsync < TEntity , TKey > ( TodoListContext context , TEntity entity ,
52- Func < RolePermissions , bool > permission )
53- where TEntity : class , IEntity < TKey >
54- where TKey : IEquatable < TKey > ;
33+ /// <summary>
34+ /// Asynchronously checks whether the user can touch an entity.
35+ /// </summary>
36+ /// <remarks>
37+ /// This method firstly checks whether <paramref name="entity"/> implements <see cref="IHasOwner"/>
38+ /// interface and if yes, checks if the user is the owner of the entity and is a member of the to-do list;
39+ /// otherwise the method checks if user has the permission defined by the function <paramref name="permission"/>.
40+ /// </remarks>
41+ /// <typeparam name="TEntity">Type of the entity.</typeparam>
42+ /// <typeparam name="TKey">Type of the unique identifier used by the entity.</typeparam>
43+ /// <param name="context">To-do list context.</param>
44+ /// <param name="entity">ID of the entity.</param>
45+ /// <param name="permission">Function that should return <see langword="true"/> if user has required permission.</param>
46+ /// <returns>
47+ /// <see langword="true"/> if user is either an owner of the entity and a member of a to-do list,
48+ /// or he/she/they has permission defined by <paramref name="permission"/>; otherwise <see langword="false" />.
49+ /// </returns>
50+ Task < bool > CanTouchEntityAsync < TEntity , TKey > ( TodoListContext context , TEntity entity ,
51+ Func < RolePermissions , bool > permission )
52+ where TEntity : class , IEntity < TKey >
53+ where TKey : IEquatable < TKey > ;
5554
56- /// <summary>
57- /// Asynchronously checks whether the user has a permission to change the role
58- /// with the priority of <paramref name="rolePriority"/>.
59- /// </summary>
60- /// <param name="context">To-do list context.</param>
61- /// <param name="rolePriority">ID of the role.</param>
62- /// <param name="permission">Function that should return <see langword="true"/> if user has required permission.</param>
63- /// <returns>
64- /// <see langword="true"/> if user has <paramref name="permission"/> and highest role priority than
65- /// the <paramref name="rolePriority"/>; otherwise <see langword="false" />.
66- /// </returns>
67- Task < bool > HasPermissionOverRoleAsync ( TodoListContext context , int rolePriority ,
68- Func < RolePermissions , bool > permission ) ;
55+ /// <summary>
56+ /// Asynchronously checks whether the user has a permission to change the role
57+ /// with the priority of <paramref name="rolePriority"/>.
58+ /// </summary>
59+ /// <param name="context">To-do list context.</param>
60+ /// <param name="rolePriority">ID of the role.</param>
61+ /// <param name="permission">Function that should return <see langword="true"/> if user has required permission.</param>
62+ /// <returns>
63+ /// <see langword="true"/> if user has <paramref name="permission"/> and highest role priority than
64+ /// the <paramref name="rolePriority"/>; otherwise <see langword="false" />.
65+ /// </returns>
66+ Task < bool > HasPermissionOverRoleAsync ( TodoListContext context , int rolePriority ,
67+ Func < RolePermissions , bool > permission ) ;
6968}
0 commit comments