-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Расширения информации о правах (#465)
* add feature #108 Для MDO\MDC добавлена возможность понять можно ли управлять правами доступа и какими * add feature #108 Добавлены методы определения наличия нужного права и списка ролей с ныжным правом
- Loading branch information
1 parent
280e7d0
commit d2dd7df
Showing
50 changed files
with
1,385 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
102 changes: 102 additions & 0 deletions
102
src/main/java/com/github/_1c_syntax/bsl/mdclasses/CFAccess.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
/* | ||
* This file is a part of MDClasses. | ||
* | ||
* Copyright (c) 2019 - 2024 | ||
* Tymko Oleg <[email protected]>, Maximov Valery <[email protected]> and contributors | ||
* | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
* | ||
* MDClasses is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 3.0 of the License, or (at your option) any later version. | ||
* | ||
* MDClasses is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with MDClasses. | ||
*/ | ||
package com.github._1c_syntax.bsl.mdclasses; | ||
|
||
|
||
import com.github._1c_syntax.bsl.mdclasses.helpers.Rights; | ||
import com.github._1c_syntax.bsl.mdo.AccessRightsOwner; | ||
import com.github._1c_syntax.bsl.mdo.MD; | ||
import com.github._1c_syntax.bsl.mdo.Role; | ||
import com.github._1c_syntax.bsl.mdo.support.RoleRight; | ||
import com.github._1c_syntax.bsl.types.MdoReference; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* Расширение - права доступа | ||
*/ | ||
public interface CFAccess extends AccessRightsOwner { | ||
|
||
/** | ||
* Проверяет наличие указанного разрешения хотя бы у одной роли для конфигурации/расширения | ||
* | ||
* @param roleRight Право доступа | ||
* @return Наличие права доступа | ||
*/ | ||
default boolean rightAccess(RoleRight roleRight) { | ||
return Rights.rightAccess((CF) this, roleRight); | ||
} | ||
|
||
/** | ||
* Проверяет наличие указанного разрешения хотя бы у одной роли для MD | ||
* | ||
* @param roleRight Право доступа | ||
* @param md Любой объект md | ||
* @return Наличие права доступа | ||
*/ | ||
default boolean rightAccess(RoleRight roleRight, MD md) { | ||
return Rights.rightAccess((CF) this, roleRight, md); | ||
} | ||
|
||
/** | ||
* Проверяет наличие указанного разрешения хотя бы у одной роли для ссылки | ||
* | ||
* @param roleRight Право доступа | ||
* @param mdoReference Ссылка mdo reference | ||
* @return Наличие права доступа | ||
*/ | ||
default boolean rightAccess(RoleRight roleRight, MdoReference mdoReference) { | ||
return Rights.rightAccess((CF) this, roleRight, mdoReference); | ||
} | ||
|
||
/** | ||
* Возвращает список ролей, имеющих указанное разрешения для конфигурации/расширения | ||
* | ||
* @param roleRight Право доступа | ||
* @return Список ролей с правом | ||
*/ | ||
default List<Role> rolesAccess(RoleRight roleRight) { | ||
return Rights.rolesAccess((CF) this, roleRight); | ||
} | ||
|
||
/** | ||
* Возвращает список ролей, имеющих указанное разрешения для md | ||
* | ||
* @param roleRight Право доступа | ||
* @param md Любой объект md | ||
* @return Список ролей с правом | ||
*/ | ||
default List<Role> rolesAccess(RoleRight roleRight, MD md) { | ||
return Rights.rolesAccess((CF) this, roleRight, md); | ||
} | ||
|
||
/** | ||
* Возвращает список ролей, имеющих указанное разрешения для ссылки | ||
* | ||
* @param roleRight Право доступа | ||
* @param mdoReference Ссылка mdo reference | ||
* @return Список ролей с правом | ||
*/ | ||
default List<Role> rolesAccess(RoleRight roleRight, MdoReference mdoReference) { | ||
return Rights.rolesAccess((CF) this, roleRight, mdoReference); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.