-
Notifications
You must be signed in to change notification settings - Fork 1
/
IPermissionComponent.cs
38 lines (35 loc) · 1.94 KB
/
IPermissionComponent.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using Sandbox;
using Sandmod.Permission.Provider;
using Sandmod.Permission.Target;
namespace Sandmod.Permission;
/// <summary>
/// Implementable permission component representing partial permissions of an <see cref="IClient" />,
/// checked via the <see cref="IClient" />'s <see cref="PermissionExtensions.HasPermission" /> method.
/// <br /><br />
/// <b>IMPORTANT!</b>
/// <br />
/// For this component to be taken into account on the <see cref="IClient" />'s
/// <see cref="PermissionExtensions.HasPermission" /> check,
/// the component needs to be added to the <see cref="IClient" />'s <see cref="IClient.Components" />.
/// <br />
/// Create a <see cref="IPermissionProvider" /> to provide your own implementations.
/// <br /><br />
/// It can be used somewhere else as well, for your own purposes but it won't be taken into account on the
/// <see cref="IClient" />'s <see cref="PermissionExtensions.HasPermission" /> check.
/// </summary>
public interface IPermissionComponent : IComponent
{
/// <summary>
/// Checks the <see cref="IPermissionComponent" />'s permissions of the owning <see cref="IClient" /> for the <b><paramref name="permission" /></b>.
/// </summary>
/// <param name="permission">Permission to check</param>
/// <returns>If the<b><paramref name="permission" /></b>is granted, not granted or denied</returns>
public Permission.Result CheckPermission(string permission);
/// <summary>
/// Checks the <see cref="IPermissionComponent" />'s permissions of the owning <see cref="IClient" /> for the <b><paramref name="permission" /></b> and <b><paramref name="target" /></b>.
/// </summary>
/// <param name="permission">Permission to check</param>
/// <param name="target">Target to check the permissions for</param>
/// <returns>If the<b><paramref name="permission" /></b>is granted, not granted or denied</returns>
public Permission.Result CheckPermission(string permission, IPermissionTarget target);
}