Skip to content

Commit

Permalink
Sync functions only on client
Browse files Browse the repository at this point in the history
  • Loading branch information
StorytellerCZ committed Apr 8, 2024
1 parent d9adc15 commit ab55827
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 2,709 deletions.
7 changes: 7 additions & 0 deletions History.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## v4.0.0

* BREAKING: Synchronous functions are now available only on client side
* * BREAKING: Migration functions for past versions are no longer available
* UI Helpers now use `console.debug` for debugging messages
* `RolesCollection` and `RoleAssignmentsCollection` can now be exported in addition to being accessed via `Meteor.roles` and `Meteor.roleAssignment`

## v3.6.2

* Fixed TypeScript definition to play nice with Meteor definition [#389](https://github.com/Meteor-Community-Packages/meteor-roles/pull/389) [@bruceborrett](https://github.com/sponsors/bruceborrett)
Expand Down
5 changes: 5 additions & 0 deletions definitions.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,11 @@ declare namespace Roles {

} // module

// Exported collections
declare type RolesCollection = Mongo.Collection<Roles.Role>
declare type RoleAssignmentsCollection = Mongo.Collection<Roles.RoleAssignment>

// Additions to the Meteor object
declare module 'meteor/meteor' {
namespace Meteor {
const roles: Mongo.Collection<Roles.Role>
Expand Down
8 changes: 4 additions & 4 deletions package.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Package.describe({
})

Package.onUse(function (api) {
api.versionsFrom(['2.8.1', '3.0-alpha.11'])
api.versionsFrom(['2.8.1', '3.0-beta.7'])

const both = ['client', 'server']

Expand All @@ -20,13 +20,13 @@ Package.onUse(function (api) {
'check'
], both)

api.use('zodern:[email protected].11')
api.use('zodern:[email protected].13')

api.use(['blaze@2.7.1'], 'client', { weak: true })
api.use(['blaze@2.9.0'], 'client', { weak: true })

api.export('Roles')

api.addFiles('roles/roles_common.js', both)
api.addFiles('roles/roles_client.js', 'client')
api.addFiles('roles/roles_common_async.js', both)
api.addFiles('roles/roles_server.js', 'server')
api.addFiles([
Expand Down
12 changes: 3 additions & 9 deletions roles/roles_common.js → roles/roles_client.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
/* global Meteor, Roles, Mongo */
/* global Meteor, Roles */
import { Meteor } from 'meteor/meteor'

/**
* Provides functions related to user authorization. Compatible with built-in Meteor accounts packages.
*
* Roles are accessible throgh `Meteor.roles` collection and documents consist of:
* Roles are accessible through `Meteor.roles` collection and documents consist of:
* - `_id`: role name
* - `children`: list of subdocuments:
* - `_id`
Expand All @@ -24,13 +25,6 @@
*
* @module Roles
*/
if (!Meteor.roles) {
Meteor.roles = new Mongo.Collection('roles')
}

if (!Meteor.roleAssignment) {
Meteor.roleAssignment = new Mongo.Collection('role-assignment')
}

/**
* @class Roles
Expand Down
Loading

0 comments on commit ab55827

Please sign in to comment.