Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"contenttype",
)
@configure.service(
context=IApplication, method="GET", permission="guillotina.AccessContent", name="@raise-http-exception"
)
@configure.service(
context=IApplication, method="POST", permission="guillotina.AccessContent", name="@raise-http-exception"
)
async def raise_http_exception(context, request):
raise HTTPUnprocessableEntity()
# Create a new permission and grant it to authenticated users only
configure.permission("example.EndpointPermission", "example permission")
configure.grant(permission="example.EndpointPermission", role="guillotina.Authenticated")
@configure.service(
context=IApplication, method="GET", permission="example.EndpointPermission", name="@myEndpoint"
)
async def my_endpoint(context, request):
return {"foo": "bar"}
class ITestAsyncUtility(IAsyncUtility):
pass
@configure.utility(provides=ITestAsyncUtility)
class AsyncUtility:
from guillotina import configure
configure.permission("guillotina.AccessContent", "Access content")
configure.permission("guillotina.ModifyContent", "Modify content")
configure.permission("guillotina.DeleteContent", "Delete content")
configure.permission("guillotina.AddContent", "Add content")
configure.permission("guillotina.MoveContent", "Move content")
configure.permission("guillotina.DuplicateContent", "Duplicate content")
configure.permission("guillotina.ViewContent", "View content")
configure.permission("guillotina.AddContainer", "Add a portal/DB")
configure.permission("guillotina.GetContainers", "Get a portal/DB")
configure.permission("guillotina.DeleteContainers", "Delete a portal")
configure.permission("guillotina.MountDatabase", "Mount a Database")
configure.permission("guillotina.GetDatabases", "Get Databases")
configure.permission("guillotina.UmountDatabase", "Umount a Database")
configure.permission("guillotina.AccessPreflight", "Access Preflight View")
configure.permission("guillotina.ReadConfiguration", "Read a configuration")
configure.permission("guillotina.WriteConfiguration", "Write a configuration")
configure.permission("guillotina.RegisterConfigurations", "Register a new configuration on Registry")
configure.permission("guillotina.ReadConfiguration", "Read a configuration")
configure.permission("guillotina.WriteConfiguration", "Write a configuration")
configure.permission("guillotina.RegisterConfigurations", "Register a new configuration on Registry")
configure.permission("guillotina.ManageAddons", "Manage addons on a container")
configure.permission("guillotina.SeePermissions", "See permissions")
configure.permission("guillotina.ChangePermissions", "Change permissions")
configure.permission("guillotina.RefreshToken", "Refresh token")
configure.permission("guillotina.SearchContent", "Search content")
configure.permission("guillotina.RawSearchContent", "Raw search content")
configure.permission("guillotina.ReindexContent", "Reindex Content")
configure.permission("guillotina.ManageCatalog", "Manage catalog")
configure.permission("guillotina.GetAPIDefinition", "Get the API definition")
configure.permission("guillotina.Public", "Public access to content")
configure.permission("guillotina.WebSocket", "Access to websocket")
configure.permission("guillotina.CacheManage", "Manage cache")
configure.role("guillotina.Anonymous", "Everybody", "All users have this role implicitly", False)
configure.role(
"guillotina.Authenticated",
"Authenticated user",
"Role automatically assigned to authenticated users",
False,
)
configure.role("guillotina.Member", "Member", False)
from guillotina import configure
configure.permission("guillotina.AccessContent", "Access content")
configure.permission("guillotina.ModifyContent", "Modify content")
configure.permission("guillotina.DeleteContent", "Delete content")
configure.permission("guillotina.AddContent", "Add content")
configure.permission("guillotina.MoveContent", "Move content")
configure.permission("guillotina.DuplicateContent", "Duplicate content")
configure.permission("guillotina.ViewContent", "View content")
configure.permission("guillotina.AddContainer", "Add a portal/DB")
configure.permission("guillotina.GetContainers", "Get a portal/DB")
configure.permission("guillotina.DeleteContainers", "Delete a portal")
configure.permission("guillotina.MountDatabase", "Mount a Database")
configure.permission("guillotina.GetDatabases", "Get Databases")
configure.permission("guillotina.UmountDatabase", "Umount a Database")
configure.permission("guillotina.AccessPreflight", "Access Preflight View")
from guillotina import configure
configure.permission("guillotina.AccessContent", "Access content")
configure.permission("guillotina.ModifyContent", "Modify content")
configure.permission("guillotina.DeleteContent", "Delete content")
configure.permission("guillotina.AddContent", "Add content")
configure.permission("guillotina.MoveContent", "Move content")
configure.permission("guillotina.DuplicateContent", "Duplicate content")
configure.permission("guillotina.ViewContent", "View content")
configure.permission("guillotina.AddContainer", "Add a portal/DB")
configure.permission("guillotina.GetContainers", "Get a portal/DB")
configure.permission("guillotina.DeleteContainers", "Delete a portal")
configure.permission("guillotina.MountDatabase", "Mount a Database")
configure.permission("guillotina.GetDatabases", "Get Databases")
configure.permission("guillotina.UmountDatabase", "Umount a Database")
configure.permission("guillotina.AccessPreflight", "Access Preflight View")
configure.permission("guillotina.ReadConfiguration", "Read a configuration")
configure.permission("guillotina.WriteConfiguration", "Write a configuration")
configure.permission("guillotina.RegisterConfigurations", "Register a new configuration on Registry")
configure.permission("guillotina.ManageAddons", "Manage addons on a container")
configure.permission("guillotina.SeePermissions", "See permissions")
configure.permission("guillotina.ChangePermissions", "Change permissions")
configure.permission("guillotina.SeePermissions", "See permissions")
configure.permission("guillotina.ChangePermissions", "Change permissions")
configure.permission("guillotina.RefreshToken", "Refresh token")
configure.permission("guillotina.SearchContent", "Search content")
configure.permission("guillotina.RawSearchContent", "Raw search content")
configure.permission("guillotina.ReindexContent", "Reindex Content")
configure.permission("guillotina.ManageCatalog", "Manage catalog")
configure.permission("guillotina.GetAPIDefinition", "Get the API definition")
configure.permission("guillotina.Public", "Public access to content")
configure.permission("guillotina.WebSocket", "Access to websocket")
configure.permission("guillotina.CacheManage", "Manage cache")
configure.role("guillotina.Anonymous", "Everybody", "All users have this role implicitly", False)
configure.role(
"guillotina.Authenticated",
"Authenticated user",
"Role automatically assigned to authenticated users",
False,
)
configure.role("guillotina.Member", "Member", False)
configure.role("guillotina.Reader", "Reader", "can read content", True)
configure.role("guillotina.Editor", "Editor", "can edit content", True)
configure.role("guillotina.Reviewer", "Reviewer", "can review content", True)
configure.role("guillotina.Owner", "Content Manager", "can add/delete content", True)
configure.role("guillotina.Manager", "Container Manager", False)
from guillotina import configure
configure.permission("guillotina.AddUser", title="Add plone user")
configure.permission("guillotina.AddGroup", title="Add plone group")
configure.permission("guillotina.Nobody", "Permission not assigned to anyone")
configure.permission("guillotina.ManageUsers", "Manage Users on site", "Be able to manage users on site")
configure.grant(permission="guillotina.AddUser", role="guillotina.Manager")
configure.grant(permission="guillotina.AddGroup", role="guillotina.Manager")
configure.grant(permission="guillotina.ManageUsers", role="guillotina.Manager")
configure.grant(permission="guillotina.AddUser", role="guillotina.ContainerAdmin")
configure.grant(permission="guillotina.AddGroup", role="guillotina.ContainerAdmin")
configure.grant(permission="guillotina.ManageUsers", role="guillotina.ContainerAdmin")
configure.permission("guillotina.DuplicateContent", "Duplicate content")
configure.permission("guillotina.ViewContent", "View content")
configure.permission("guillotina.AddContainer", "Add a portal/DB")
configure.permission("guillotina.GetContainers", "Get a portal/DB")
configure.permission("guillotina.DeleteContainers", "Delete a portal")
configure.permission("guillotina.MountDatabase", "Mount a Database")
configure.permission("guillotina.GetDatabases", "Get Databases")
configure.permission("guillotina.UmountDatabase", "Umount a Database")
configure.permission("guillotina.AccessPreflight", "Access Preflight View")
configure.permission("guillotina.ReadConfiguration", "Read a configuration")
configure.permission("guillotina.WriteConfiguration", "Write a configuration")
configure.permission("guillotina.RegisterConfigurations", "Register a new configuration on Registry")
configure.permission("guillotina.ManageAddons", "Manage addons on a container")
configure.permission("guillotina.SeePermissions", "See permissions")
configure.permission("guillotina.ChangePermissions", "Change permissions")
configure.permission("guillotina.RefreshToken", "Refresh token")
configure.permission("guillotina.SearchContent", "Search content")
configure.permission("guillotina.RawSearchContent", "Raw search content")
configure.permission("guillotina.ReindexContent", "Reindex Content")
configure.permission("guillotina.ManageCatalog", "Manage catalog")
configure.permission("guillotina.GetAPIDefinition", "Get the API definition")
configure.permission("guillotina.Public", "Public access to content")
configure.permission("guillotina.WebSocket", "Access to websocket")
configure.permission("guillotina.ModifyContent", "Modify content")
configure.permission("guillotina.DeleteContent", "Delete content")
configure.permission("guillotina.AddContent", "Add content")
configure.permission("guillotina.MoveContent", "Move content")
configure.permission("guillotina.DuplicateContent", "Duplicate content")
configure.permission("guillotina.ViewContent", "View content")
configure.permission("guillotina.AddContainer", "Add a portal/DB")
configure.permission("guillotina.GetContainers", "Get a portal/DB")
configure.permission("guillotina.DeleteContainers", "Delete a portal")
configure.permission("guillotina.MountDatabase", "Mount a Database")
configure.permission("guillotina.GetDatabases", "Get Databases")
configure.permission("guillotina.UmountDatabase", "Umount a Database")
configure.permission("guillotina.AccessPreflight", "Access Preflight View")
configure.permission("guillotina.ReadConfiguration", "Read a configuration")
configure.permission("guillotina.WriteConfiguration", "Write a configuration")
configure.permission("guillotina.RegisterConfigurations", "Register a new configuration on Registry")
configure.permission("guillotina.ManageAddons", "Manage addons on a container")
configure.permission("guillotina.SeePermissions", "See permissions")
configure.permission("guillotina.ChangePermissions", "Change permissions")
configure.permission("guillotina.RefreshToken", "Refresh token")
configure.permission("guillotina.SearchContent", "Search content")
configure.permission("guillotina.RawSearchContent", "Raw search content")
configure.permission("guillotina.ReindexContent", "Reindex Content")
configure.permission("guillotina.ManageCatalog", "Manage catalog")