Service - Account Limits: Difference between revisions

From Izara Wiki
Jump to navigation Jump to search
(Created page with "= Overview = Controls a user's limits for actions based on their roles set in Service - RBAC = Repository = https://bitbucket.org/izara-core-user-accounts/izara-core-user-accounts-account-limits/src/master/ = DynamoDB tables = == Standard Config Table Per Service == === Configuration tags === <syntaxhighlight lang="JavaScript"> { configKey: "MediaGraphServiceName" configTag: "MediaGraphServiceName" configValue: xxx // eg: "MediaGraph" } </syntaxhighligh...")
 
No edit summary
Line 2: Line 2:


Controls a user's limits for actions based on their roles set in [[Service - RBAC]]
Controls a user's limits for actions based on their roles set in [[Service - RBAC]]
* Works out each user’s site limits according to the user’s app_level RBAC roles
* Records user’s usage for counted limit types


= Repository =
= Repository =
Line 15: Line 18:
<syntaxhighlight lang="JavaScript">
<syntaxhighlight lang="JavaScript">
{
{
configKey: "MediaGraphServiceName"
configKey: "RbacServiceName"
configTag: "MediaGraphServiceName"
configTag: "RbacServiceName"
configValue: xxx // eg: "MediaGraph"
configValue: xxx // eg: "RBAC"
}
</syntaxhighlight>
 
<syntaxhighlight lang="JavaScript">
{
configKey: "MediaHandlerService"
configTag: xxx // mediaHandlerServiceNameTag, eg: "MediaStandard", this is what is saved in each media node
configValue: {
serviceName: xxx // eg: "ImageStandard", this is the actual deployed service name}
}
}
</syntaxhighlight>
 
== MediaRecord ==
 
Records which Handler manages each media element
 
<syntaxhighlight lang="JavaScript">
{
mediaId
mediaHandlerServiceNameTag
}
}
</syntaxhighlight>
</syntaxhighlight>


* partition key: mediaId
= Limit types =
* sort key: (none)
 
= Graph database =  


== [[Service - Media Graph]]==
== static limits ==


=== Nodes ===
* limits that are fixed
* eg size limit for an uploaded photo or video.
* static limits do not need to record usage by each user


== time based limits ==


<syntaxhighlight lang="JavaScript">
* eg number of products can list per day.
{
* have a record of usage
nodeLabel: "media",
* when the user attempts to perform action it is checked first to not exceed their limit, then the use is reserved, once the client service completes the action the use is confirmed
schema: {
* time_based_dynamic: counts usage over the last period, counted from the time the request to perform the use is made
identifier: true,
restrictProperties: true,
restrictRelationships: true,
properties: {
mediaId: {
identifier: true, // create unique id from request details
},
mediaHandlerServiceNameTag: {
immutable: true,
},
},
}
}
</syntaxhighlight>


<syntaxhighlight lang="JavaScript">
== running_total limits ==
{
nodeLabel: "mediaPropertyLabel",
}
{
nodeLabel: "mediaProperty",
}
</syntaxhighlight>
* see [[NPM module - Izara Core - Property Node|DataSchemaLib]]


=== Relationships ===
* Maximum number of times an action can be performed
* eg maximum number of products a user can list.
* usage is counted but not time based
* can be added to or subtracted from
* eg: storage_space_used
* has process to reserve usage


<syntaxhighlight lang="JavaScript">
= FindData in RBAC =
{
relationshipType: "has_mediaProperty",
}
{
relationshipType: "disabled_mediaProperty",
}
{
relationshipType: "is_mediaPropertyLabel",
}
</syntaxhighlight>
* see [[NPM module - Izara Core - Property Node|DataSchemaLib]]


== Basic node schemas ==
Use FindData in RBAC to find a users current limits, this will allow for cacheing and can add to tables/SearchResults etc..


Schema comes from [[NPM module - Izara Core - Property Node|BasicNodeSchemaLib]]
= Ideas =


# mediaPropertyLabel
* Currently thinking cannot have per user overwrites, can create roles to affect limits
#* [[Service - Translations Graph]]
* Could have per user/catalog limits too, probably as separate Account Limit services
# mediaProperty
* another possible time based limit: (can add later) time_based_period: has a set time when the count is reset, eg: per day, count resetting at midnight
#* [[Service - Translations Graph]]


= Working documents =
= Working documents =


[[:Category:Working_documents - Media Manager|Media Manager]]
[[:Category:Working_documents - Account Limits|Account Limits]]


[[Category:Backend services| Media Manager]]
[[Category:Backend services| Account Limits]]

Revision as of 13:41, 26 October 2022

Overview

Controls a user's limits for actions based on their roles set in Service - RBAC

  • Works out each user’s site limits according to the user’s app_level RBAC roles
  • Records user’s usage for counted limit types

Repository

https://bitbucket.org/izara-core-user-accounts/izara-core-user-accounts-account-limits/src/master/

DynamoDB tables

Standard Config Table Per Service

Configuration tags

{
	configKey: "RbacServiceName"
	configTag: "RbacServiceName"
	configValue: xxx // eg: "RBAC"
}

Limit types

static limits

  • limits that are fixed
  • eg size limit for an uploaded photo or video.
  • static limits do not need to record usage by each user

time based limits

  • eg number of products can list per day.
  • have a record of usage
  • when the user attempts to perform action it is checked first to not exceed their limit, then the use is reserved, once the client service completes the action the use is confirmed
  • time_based_dynamic: counts usage over the last period, counted from the time the request to perform the use is made

running_total limits

  • Maximum number of times an action can be performed
  • eg maximum number of products a user can list.
  • usage is counted but not time based
  • can be added to or subtracted from
  • eg: storage_space_used
  • has process to reserve usage

FindData in RBAC

Use FindData in RBAC to find a users current limits, this will allow for cacheing and can add to tables/SearchResults etc..

Ideas

  • Currently thinking cannot have per user overwrites, can create roles to affect limits
  • Could have per user/catalog limits too, probably as separate Account Limit services
  • another possible time based limit: (can add later) time_based_period: has a set time when the count is reset, eg: per day, count resetting at midnight

Working documents

Account Limits