Skip to content
This repository was archived by the owner on Apr 13, 2024. It is now read-only.

Commit 96bd0e5

Browse files
committed
feat: Improved Permissions and Permits API
1 parent fed0534 commit 96bd0e5

3 files changed

Lines changed: 998 additions & 38 deletions

File tree

src/main/kotlin/Access.kt

Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
/*
2+
* Copyright 2022 cufy.org
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.cufy.openperm
17+
18+
/**
19+
* A marker interface for objects that is used as
20+
* access specifiers.
21+
*
22+
* @author LSafer
23+
* @since 1.3.0
24+
*/
25+
interface Access {
26+
/**
27+
* Marker interface for operation-based access.
28+
*
29+
* @author LSafer
30+
* @since 1.3.0
31+
*/
32+
interface Operation : Access {
33+
/**
34+
* Marker interface for read access.
35+
*
36+
* @author LSafer
37+
* @since 1.3.0
38+
*/
39+
interface Read : Operation {
40+
/**
41+
* Access marker for read access.
42+
*
43+
* @author LSafer
44+
* @since 1.3.0
45+
*/
46+
companion object : Read
47+
}
48+
49+
/**
50+
* Marker interface for write-operation access.
51+
*
52+
* @author LSafer
53+
* @since 1.3.0
54+
*/
55+
interface Write : Operation {
56+
/**
57+
* Access marker for write access.
58+
*
59+
* @author LSafer
60+
* @since 1.3.0
61+
*/
62+
companion object : Write
63+
}
64+
}
65+
66+
/**
67+
* Marker interface for level-based access.
68+
*
69+
* @author LSafer
70+
* @since 1.3.0
71+
*/
72+
interface Level : Access {
73+
/**
74+
* Marker interface for anonymous-level access.
75+
*
76+
* @author LSafer
77+
* @since 1.3.0
78+
*/
79+
interface Anonymous : Level {
80+
/**
81+
* Access marker for anonymous-level access.
82+
*
83+
* @author LSafer
84+
* @since 1.3.0
85+
*/
86+
companion object : Anonymous
87+
}
88+
89+
/**
90+
* Marker interface for default-level access.
91+
*
92+
* @author LSafer
93+
* @since 1.3.0
94+
*/
95+
interface Default : Level {
96+
/**
97+
* Access marker for default-level access.
98+
*
99+
* @author LSafer
100+
* @since 1.3.0
101+
*/
102+
companion object : Default
103+
}
104+
105+
/**
106+
* Marker interface for owner-level access.
107+
*
108+
* @author LSafer
109+
* @since 1.3.0
110+
*/
111+
interface Owner : Level {
112+
/**
113+
* Access marker for owner-level access.
114+
*
115+
* @author LSafer
116+
* @since 1.3.0
117+
*/
118+
companion object : Owner
119+
}
120+
}
121+
122+
/**
123+
* Access marker for anonymous-level read access.
124+
*
125+
* @author LSafer
126+
* @since 1.3.0
127+
*/
128+
object AnonymousRead : Operation.Read, Level.Anonymous
129+
130+
/**
131+
* Access marker for anonymous-level write access.
132+
*
133+
* @author LSafer
134+
* @since 1.3.0
135+
*/
136+
object AnonymousWrite : Operation.Write, Level.Anonymous
137+
138+
/**
139+
* Access marker for default-level read access.
140+
*
141+
* @author LSafer
142+
* @since 1.3.0
143+
*/
144+
object Read : Operation.Read, Level.Default
145+
146+
/**
147+
* Access marker for default-level write access.
148+
*
149+
* @author LSafer
150+
* @since 1.3.0
151+
*/
152+
object Write : Operation.Write, Level.Default
153+
154+
/**
155+
* Access marker for owner-level read access.
156+
*
157+
* @author LSafer
158+
* @since 1.3.0
159+
*/
160+
object OwnerRead : Operation.Read, Level.Owner
161+
162+
/**
163+
* Access marker for owner-level write access.
164+
*
165+
* @author LSafer
166+
* @since 1.3.0
167+
*/
168+
object OwnerWrite : Operation.Write, Level.Owner
169+
}

0 commit comments

Comments
 (0)